diff options
author | Akshay <[email protected]> | 2021-04-20 16:09:36 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2021-04-20 16:09:36 +0100 |
commit | 5c239f9a420ea86fae08be70deece25e0e1b98ff (patch) | |
tree | b969ecf0745147fb1f178f90ce3da567b5355bd0 | |
parent | 699375e14c63ca6f52b79b56de1d572c3497587a (diff) |
readd cursor; compress images with RLE
-rw-r--r-- | Cargo.lock | 1 | ||||
-rw-r--r-- | Cargo.toml | 3 | ||||
-rw-r--r-- | src/app.rs | 5 |
3 files changed, 4 insertions, 5 deletions
@@ -122,7 +122,6 @@ checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" | |||
122 | [[package]] | 122 | [[package]] |
123 | name = "obi" | 123 | name = "obi" |
124 | version = "0.1.0" | 124 | version = "0.1.0" |
125 | source = "git+https://github.com/nerdypepper/obi?rev=7d2924015e691fa229c6b6fd96240ef47b3a9e5f#7d2924015e691fa229c6b6fd96240ef47b3a9e5f" | ||
126 | dependencies = [ | 125 | dependencies = [ |
127 | "bitvec", | 126 | "bitvec", |
128 | "byteorder", | 127 | "byteorder", |
@@ -8,7 +8,8 @@ edition = "2018" | |||
8 | 8 | ||
9 | [dependencies] | 9 | [dependencies] |
10 | sdl2 = {version = "0.34", features = ["ttf"]} | 10 | sdl2 = {version = "0.34", features = ["ttf"]} |
11 | obi = { git = "https://github.com/nerdypepper/obi", rev = "7d2924015e691fa229c6b6fd96240ef47b3a9e5f" } | 11 | # obi = { git = "https://github.com/nerdypepper/obi", rev = "63af58d6a3fd68bdb313305881627dab534346e2" } |
12 | obi = { path = "../obi"} | ||
12 | env_logger = "0.8.3" | 13 | env_logger = "0.8.3" |
13 | log = "0.4.0" | 14 | log = "0.4.0" |
14 | pico-args = "0.4.0" | 15 | pico-args = "0.4.0" |
@@ -26,7 +26,7 @@ use std::{ | |||
26 | path::{Path, PathBuf}, | 26 | path::{Path, PathBuf}, |
27 | }; | 27 | }; |
28 | 28 | ||
29 | use obi::Image; | 29 | use obi::{CompressionType, Image}; |
30 | use sdl2::{ | 30 | use sdl2::{ |
31 | event::Event, | 31 | event::Event, |
32 | keyboard::{Keycode, Mod}, | 32 | keyboard::{Keycode, Mod}, |
@@ -428,11 +428,9 @@ impl<'ctx> AppState<'ctx> { | |||
428 | fn draw_brush(&mut self) { | 428 | fn draw_brush(&mut self) { |
429 | let cs = self.zoom as u32; | 429 | let cs = self.zoom as u32; |
430 | let pt = self.idx_at_coord(self.mouse); | 430 | let pt = self.idx_at_coord(self.mouse); |
431 | self.context.mouse().show_cursor(true); | ||
432 | if matches!(self.brush, Brush::Circle { .. } | Brush::Line { .. }) { | 431 | if matches!(self.brush, Brush::Circle { .. } | Brush::Line { .. }) { |
433 | let size = self.brush.size().unwrap(); | 432 | let size = self.brush.size().unwrap(); |
434 | if let Some(center) = pt { | 433 | if let Some(center) = pt { |
435 | self.context.mouse().show_cursor(false); | ||
436 | let circle = self.pixmap.get_circle(center, size as u32, false); | 434 | let circle = self.pixmap.get_circle(center, size as u32, false); |
437 | for MapPoint { x, y } in circle.into_iter() { | 435 | for MapPoint { x, y } in circle.into_iter() { |
438 | self.canvas.set_draw_color(PINK); | 436 | self.canvas.set_draw_color(PINK); |
@@ -657,6 +655,7 @@ impl<'ctx> AppState<'ctx> { | |||
657 | 655 | ||
658 | pub fn export(&self) -> Image { | 656 | pub fn export(&self) -> Image { |
659 | let mut image = Image::new(self.width(), self.height()); | 657 | let mut image = Image::new(self.width(), self.height()); |
658 | image.use_compression(CompressionType::RLE); | ||
660 | image.data = self.pixmap.data.clone(); | 659 | image.data = self.pixmap.data.clone(); |
661 | image | 660 | image |
662 | } | 661 | } |