Write infrastructure for pixel access in filters
The C code for filter effects has a lot of nested for
loops on plain char *
buffers.
To port the filters to Rust, it would be nice to have some safe iterators over pixel data.
-
Some filters just do something to each pixel. An iterator similar to the image crate's one could be nice:
for (x, y, pixel) in imgbuf.enumerate_pixels_mut() { ... do something with the pixel value ... *pixel = image::SomePixelFormat(new_value); }
-
Some filters (convolutions in particular) require a window of data around every pixel. WebKit has some nice abstractions for this to handle edge pixels.
-
Are there any filters that require random access to the pixel buffer? How do we eliminate bounds checks?