quadrupleslap / scrap

📸 Screen capture made easy!
https://crates.io/crates/scrap
601 stars 67 forks source link

Mutable methods #23

Open owenthewizard opened 5 years ago

owenthewizard commented 5 years ago

Would it be possible to write mutable versions of functions to allow for in-place image editing? For example, the BGRA --> RGBA in examples/screenshot.rs could be rewritten as:

for pixel in buffer.chunks_exact_mut(4) {
    unsafe { pixel.get_unchecked_mut(0..3).reverse() }
}

Not sure if that's actually better but I'm working on a project that could use scrap if it allowed in-place editing of the screenshot.

owenthewizard commented 5 years ago

I think I could write a PR for this.

owenthewizard commented 5 years ago

24