Closed tmheath closed 6 months ago
I'm not really sure what you question is, but pixel
has type &mut Pixel
so you probably want to update it via:
*pixel = pixel.0.map(|_| { 250 })
Thank you... Each iteration yields the two numbers and the pixel, I don't understand what the numbers are
The two integers are the (x, y) coordinate of the pixel, with (0, 0) corresponding to the top left of the image
Thank you, I'd assumed that but wasn't sure, iteration over rows gives the row and cells so I thought it would have been odd the enumeration over I'm understanding right?
From my code
x and y each are u32, the documentation states correctly that iteration results in (u32, u32, Pixel), but it says nothing about what the numbers are.
My question is what is being returned here. My previous attempt at solving what I need to do involved a bunch of unsafe raw pointer operations causing multiple segfaults. If you know of a better way offhand or general advise then it's welcome.
Relevant documentation https://docs.rs/image/0.25.1/i686-pc-windows-msvc/image/buffer/struct.EnumerateRowsMut.html https://docs.rs/image/0.25.1/i686-pc-windows-msvc/image/buffer/struct.EnumeratePixelsMut.html#method.next