Replies: 1 comment 2 replies
-
Honestly there is no need for a 2D array, but you might be able to cast the slice to a slice-of-slices with something like Traditionally, pixel plotting would be done with the formula: let index = (y * width + x) * 4; Since the color is itself a slice, you can use buffer[index..index + 4].copy_from_slice(&color); Something like this. Have a look at the minimal example to see how it copies colors to the buffer: pixels/examples/minimal-winit/src/main.rs Lines 103 to 124 in 4ee5006 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am using pixels for some time now and i would like to know a way to access the framebuffer like a 2D array (width, height), however I am not able to find something. i need this so i can change a pixel's color in a specified position, eg:
Beta Was this translation helpful? Give feedback.
All reactions