profile
viewpoint

Alekhine51/awesome-redshift 3

A repository of games made for the TEC Redshift, a fictional, virtual handheld console in Zachtronic's EXAPUNKS. You can get a free version on Steam.

Alekhine51/Pentest-resources 2

A list of cybersecurity resources for pentesters and security students.

Alekhine51/armitage 0

Automatically exported from code.google.com/p/armitage

Alekhine51/awesome-reversing 0

A curated list of awesome reversing resources

Alekhine51/CipherClassic 0

A suite of CLI classical encryption tools

startedkamui-7/Gazou-OCR

started time in 12 hours

issue openedAlekhine51/awesome-redshift

Possible more games

I don't these in the repo. Are they named differently?

https://www.youtube.com/watch?v=nmdEHSe7Uxw https://www.youtube.com/watch?v=opR7l0WANqE https://www.youtube.com/watch?v=0CzdfRRc8-o

created time in a day

fork Dont-Copy-That-Floppy/awesome-redshift

A repository of games made for the TEC Redshift, a fictional, virtual handheld console in Zachtronic's EXAPUNKS. You can get a free version on Steam.

fork in a day

startedAlekhine51/awesome-redshift

started time in a day

startedAlekhine51/awesome-redshift

started time in 2 days

startedAlekhine51/awesome-redshift

started time in 3 days

fork eshrh/Gazou-OCR

Japanese OCR for linux

fork in 3 days

push eventcloudhead/rx

Jordan Ephron

commit sha 41e3bb01f649691f126f70f9923391a5218dcf25

Fix floodfill behavior when hovering on palette FloodFill tool should change to sampler when hovering over the palette.

view details

push time in 5 days

push eventcloudhead/rx

Jordan Ephron

commit sha 237bc1d1360f2391edfc6dae522e9bd1e6e1c85a

FloodFill tool should change to sampler when hovering over the palette (#102) FloodFill tool should change to sampler when hovering over the palette.

view details

push time in 5 days

pull request commentcloudhead/rx

Change FloodFill to Sampler when hovering over the palette

Also noticed this, good stuff.

JEphron

comment created time in 5 days

push eventcloudhead/rx

Jordan Ephron

commit sha afb95f0c9809d0641b630e05e80ec485dcfdbe18

Faster FloodFill (#101)

view details

push time in 5 days

PR merged cloudhead/rx

Faster FloodFill

The flood fill algorithm introduced in https://github.com/cloudhead/rx/pull/100 was simple, but not very fast. I don't know how common it is for people to use rx to edit large-ish images, but I figured it'd be worth taking a little extra time to optimize. In release mode, this algorithm fills a 1024x1024 canvas in ~12ms, vs ~210ms for old algorithm

+172 -57

1 comment

2 changed files

JEphron

pr closed time in 5 days

Pull request review commentcloudhead/rx

Faster FloodFill

 use crate::view::layer::LayerCoords;-use crate::view::{Snapshot, View, ViewResource};+use crate::view::{View, ViewResource}; use rgx::color::Rgba8; use rgx::kit::shape2d::{Fill, Rotation, Shape, Stroke}; use rgx::kit::ZDepth;+use rgx::math::Point2; use rgx::rect::Rect; -pub fn flood_fill(-    view: &View<ViewResource>,-    starting_point: LayerCoords<u32>,+struct Grid {+    pixels: Vec<Rgba8>,+    pub width: usize,+    pub height: usize,+}++impl Grid {+    pub fn new(pixels: Vec<Rgba8>, width: usize, height: usize) -> Grid {+        Grid {+            pixels,+            width,+            height,+        }+    }++    pub fn get(&self, x: usize, y: usize) -> Option<&Rgba8> {+        if x < self.width && y < self.height {+            self.pixels.get(x + y * self.width)+        } else {+            None+        }+    }++    pub fn get_mut(&mut self, x: usize, y: usize) -> Option<&mut Rgba8> {+        if x < self.width && y < self.height {+            self.pixels.get_mut(x + y * self.width)+        } else {+            None+        }+    }+}

Ah right. I think I have an idea on how to get around that, but this isn't a blocker.

JEphron

comment created time in 5 days

Pull request review commentcloudhead/rx

Faster FloodFill

 use crate::view::layer::LayerCoords;-use crate::view::{Snapshot, View, ViewResource};+use crate::view::{View, ViewResource}; use rgx::color::Rgba8; use rgx::kit::shape2d::{Fill, Rotation, Shape, Stroke}; use rgx::kit::ZDepth;+use rgx::math::Point2; use rgx::rect::Rect; -pub fn flood_fill(-    view: &View<ViewResource>,-    starting_point: LayerCoords<u32>,+struct Grid {+    pixels: Vec<Rgba8>,+    pub width: usize,+    pub height: usize,+}++impl Grid {+    pub fn new(pixels: Vec<Rgba8>, width: usize, height: usize) -> Grid {+        Grid {+            pixels,+            width,+            height,+        }+    }++    pub fn get(&self, x: usize, y: usize) -> Option<&Rgba8> {+        if x < self.width && y < self.height {+            self.pixels.get(x + y * self.width)+        } else {+            None+        }+    }++    pub fn get_mut(&mut self, x: usize, y: usize) -> Option<&mut Rgba8> {+        if x < self.width && y < self.height {+            self.pixels.get_mut(x + y * self.width)+        } else {+            None+        }+    }+}

PixelsMut looks pretty close to what we need, but the fact that it doesn't own the data is causing some issues. I don't think I can store a PixelsMut on the FloodFIller, since I'd need to return a reference to the cloned buffer from ::new... Not sure if there's a clever way to make the borrow checker happy here.

JEphron

comment created time in 6 days

Pull request review commentcloudhead/rx

Faster FloodFill

 impl Session {                                 }                                 Tool::Pan(_) => {}                                 Tool::FloodFill => {-                                    if let Some(shapes) =-                                        flood_fill(self.active_view(), p.into(), self.fg)-                                    {+                                    let start_time = time::Instant::now();+                                    let filler =+                                        FloodFiller::new(self.active_view(), p.into(), self.fg);+                                    if let Some(shapes) = filler.and_then(|f| f.run()) {                                         self.effects.push(Effect::ViewPaintFinal(shapes));                                         self.active_view_mut().touch_layer();                                     }+                                    debug!(+                                        "flood fill in: {:?} ms",+                                        (time::Instant::now() - start_time).as_millis()

Oh yeah, that's much nicer.

JEphron

comment created time in 6 days

Pull request review commentcloudhead/rx

Faster FloodFill

 use crate::view::layer::LayerCoords;-use crate::view::{Snapshot, View, ViewResource};+use crate::view::{View, ViewResource}; use rgx::color::Rgba8; use rgx::kit::shape2d::{Fill, Rotation, Shape, Stroke}; use rgx::kit::ZDepth;+use rgx::math::Point2; use rgx::rect::Rect; -pub fn flood_fill(-    view: &View<ViewResource>,-    starting_point: LayerCoords<u32>,+struct Grid {+    pixels: Vec<Rgba8>,+    pub width: usize,+    pub height: usize,+}++impl Grid {+    pub fn new(pixels: Vec<Rgba8>, width: usize, height: usize) -> Grid {+        Grid {+            pixels,+            width,+            height,+        }+    }++    pub fn get(&self, x: usize, y: usize) -> Option<&Rgba8> {+        if x < self.width && y < self.height {+            self.pixels.get(x + y * self.width)+        } else {+            None+        }+    }++    pub fn get_mut(&mut self, x: usize, y: usize) -> Option<&mut Rgba8> {+        if x < self.width && y < self.height {+            self.pixels.get_mut(x + y * self.width)+        } else {+            None+        }+    }+}

Actually even in the latter case, you can create a PixelsMut out of the owned vector probably?

JEphron

comment created time in 7 days

Pull request review commentcloudhead/rx

Faster FloodFill

 use crate::view::layer::LayerCoords;-use crate::view::{Snapshot, View, ViewResource};+use crate::view::{View, ViewResource}; use rgx::color::Rgba8; use rgx::kit::shape2d::{Fill, Rotation, Shape, Stroke}; use rgx::kit::ZDepth;+use rgx::math::Point2; use rgx::rect::Rect; -pub fn flood_fill(-    view: &View<ViewResource>,-    starting_point: LayerCoords<u32>,+struct Grid {+    pixels: Vec<Rgba8>,+    pub width: usize,+    pub height: usize,+}++impl Grid {+    pub fn new(pixels: Vec<Rgba8>, width: usize, height: usize) -> Grid {+        Grid {+            pixels,+            width,+            height,+        }+    }++    pub fn get(&self, x: usize, y: usize) -> Option<&Rgba8> {+        if x < self.width && y < self.height {+            self.pixels.get(x + y * self.width)+        } else {+            None+        }+    }++    pub fn get_mut(&mut self, x: usize, y: usize) -> Option<&mut Rgba8> {+        if x < self.width && y < self.height {+            self.pixels.get_mut(x + y * self.width)+        } else {+            None+        }+    }+}

Could https://github.com/cloudhead/rx/blob/master/src/pixels.rs#L26 be re-used here? Or does the underlying buffer need to be owned?

JEphron

comment created time in 7 days

Pull request review commentcloudhead/rx

Faster FloodFill

 impl Session {                                 }                                 Tool::Pan(_) => {}                                 Tool::FloodFill => {-                                    if let Some(shapes) =-                                        flood_fill(self.active_view(), p.into(), self.fg)-                                    {+                                    let start_time = time::Instant::now();+                                    let filler =+                                        FloodFiller::new(self.active_view(), p.into(), self.fg);+                                    if let Some(shapes) = filler.and_then(|f| f.run()) {                                         self.effects.push(Effect::ViewPaintFinal(shapes));                                         self.active_view_mut().touch_layer();                                     }+                                    debug!(+                                        "flood fill in: {:?} ms",+                                        (time::Instant::now() - start_time).as_millis()

I think you can just do start_time.elapsed()

JEphron

comment created time in 7 days

issue commentcloudhead/rx

Is there a fill tool other than the selection fill?

Fixed in #100

bones527

comment created time in 7 days

pull request commentcloudhead/rx

Faster FloodFill

Sick. Fills 1024x1024 in 8ms on my computer.

JEphron

comment created time in 7 days

PR opened cloudhead/rx

Faster FloodFill

The flood fill algorithm introduced in https://github.com/cloudhead/rx/pull/100 was simple, but not very fast. I don't know how common it is for people to use rx to edit large-ish images, but I figured it'd be worth taking a little extra time to optimize. In release mode, this algorithm fills a 1024x1024 canvas in ~12ms, vs ~210ms for old algorithm

+175 -57

0 comment

2 changed files

pr created time in 7 days

push eventcloudhead/rx

Alexis Sellier

commit sha 699160eed2e7a210d42b6f59bc96c5a348defd68

Add link to community in README

view details

push time in 7 days

pull request commentcloudhead/rx

Add FloodFill tool

Thanks for this, and as mentioned, come hang out on discord!

JEphron

comment created time in 7 days

push eventcloudhead/rx

Jordan Ephron

commit sha afe3320caec075cfad78ce99b07960383098891d

Add FloodFill tool (#100)

view details

push time in 7 days

PR merged cloudhead/rx

Add FloodFill tool

Adds a simple FloodFill tool (accessible with the flood command), which fills a region with the foreground color. https://github.com/cloudhead/rx/issues/92

+111 -11

1 comment

7 changed files

JEphron

pr closed time in 7 days

Pull request review commentcloudhead/rx

Add FloodFill tool

+use crate::view::layer::LayerCoords;+use crate::view::{Snapshot, View, ViewResource};+use rgx::color::{Rgba8};+use rgx::kit::shape2d::{Fill, Rotation, Shape, Stroke};+use rgx::kit::ZDepth;+use rgx::rect::Rect;++pub fn flood_fill(+    view: &View<ViewResource>,+    starting_point: LayerCoords<u32>,+    replacement_color: Rgba8,+) -> Option<Vec<Shape>> {+    let (snapshot, pixels) = view.current_snapshot(view.active_layer_id)?;+    let mut canvas = pixels.clone().into_rgba8();

Yup, this makes sense now, given the other comment.

JEphron

comment created time in 7 days

Pull request review commentcloudhead/rx

Add FloodFill tool

+use crate::view::layer::LayerCoords;+use crate::view::{Snapshot, View, ViewResource};+use rgx::color::{Rgba8};+use rgx::kit::shape2d::{Fill, Rotation, Shape, Stroke};+use rgx::kit::ZDepth;+use rgx::rect::Rect;++pub fn flood_fill(+    view: &View<ViewResource>,+    starting_point: LayerCoords<u32>,+    replacement_color: Rgba8,+) -> Option<Vec<Shape>> {+    let (snapshot, pixels) = view.current_snapshot(view.active_layer_id)?;+    let mut canvas = pixels.clone().into_rgba8();+    let bounds = snapshot.extent.rect();+    let target_color = get_color(snapshot, &mut canvas, starting_point)?.clone();++    if target_color == replacement_color {+        return None;+    }++    let mut points = Vec::new();+    let mut queue = vec![starting_point];++    while let Some(point) = queue.pop() {+        if let Some(c) = get_color(snapshot, &mut canvas, point) {+            if *c == target_color {+                *c = replacement_color;

Ah, I missed that. Cool.

JEphron

comment created time in 7 days

more