How to iterate pixels of image read by stbi.load #17949
Closed
pd-giz-dave
started this conversation in
General
Replies: 1 comment
-
Ah! I think I've worked it out: mut pixels := []Pixel{len: image.width * image.height, cap: image.width * image.height} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sorry, total novice here. I can't work out how to address the pixels read from stbi.load. I can see in the debugger I've got a voidptr in image.data but how do I use that? I know how to do it in C but not in V. I tried this:
for x in 0 .. image.width {
for y in 0 .. image.height {
pixel_address := unsafe { image.data + ((y * image.width + x) * image.nr_channels) }
But that throws a compiler error
Beta Was this translation helpful? Give feedback.
All reactions