aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-04-20 16:09:36 +0100
committerAkshay <[email protected]>2021-04-20 16:09:36 +0100
commit5c239f9a420ea86fae08be70deece25e0e1b98ff (patch)
treeb969ecf0745147fb1f178f90ce3da567b5355bd0
parent699375e14c63ca6f52b79b56de1d572c3497587a (diff)
readd cursor; compress images with RLE
-rw-r--r--Cargo.lock1
-rw-r--r--Cargo.toml3
-rw-r--r--src/app.rs5
3 files changed, 4 insertions, 5 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 0390f04..2ac9444 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -122,7 +122,6 @@ checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
122[[package]] 122[[package]]
123name = "obi" 123name = "obi"
124version = "0.1.0" 124version = "0.1.0"
125source = "git+https://github.com/nerdypepper/obi?rev=7d2924015e691fa229c6b6fd96240ef47b3a9e5f#7d2924015e691fa229c6b6fd96240ef47b3a9e5f"
126dependencies = [ 125dependencies = [
127 "bitvec", 126 "bitvec",
128 "byteorder", 127 "byteorder",
diff --git a/Cargo.toml b/Cargo.toml
index c76160a..311e10b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,7 +8,8 @@ edition = "2018"
8 8
9[dependencies] 9[dependencies]
10sdl2 = {version = "0.34", features = ["ttf"]} 10sdl2 = {version = "0.34", features = ["ttf"]}
11obi = { git = "https://github.com/nerdypepper/obi", rev = "7d2924015e691fa229c6b6fd96240ef47b3a9e5f" } 11# obi = { git = "https://github.com/nerdypepper/obi", rev = "63af58d6a3fd68bdb313305881627dab534346e2" }
12obi = { path = "../obi"}
12env_logger = "0.8.3" 13env_logger = "0.8.3"
13log = "0.4.0" 14log = "0.4.0"
14pico-args = "0.4.0" 15pico-args = "0.4.0"
diff --git a/src/app.rs b/src/app.rs
index a987e0b..d0089e9 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -26,7 +26,7 @@ use std::{
26 path::{Path, PathBuf}, 26 path::{Path, PathBuf},
27}; 27};
28 28
29use obi::Image; 29use obi::{CompressionType, Image};
30use sdl2::{ 30use 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 }