How could I draw a array of pixels using Slint? #3081
-
For learning propose, I would like to draw an array of pixels returned from a lib into a Slint component and build some UI things around this drew “canvas”. However, the image component does not seem to be the best approach as this canvas must be updated in a fast step; Either 30 or 60 FPS. Can I do something like this with Slint? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi! I think if your lib provides you with pixels, the best thing you can do is try to make the lib render them straight into a slint::SharedPixelBuffer. You can get hold of the underlying bytes with Otherwise I think you're going to have to see if your lib can produce the pixels using the GPU using OpenGL and import it as a texture, like in this example. Either way a |
Beta Was this translation helpful? Give feedback.
Hi! I think if your lib provides you with pixels, the best thing you can do is try to make the lib render them straight into a slint::SharedPixelBuffer. You can get hold of the underlying bytes with
make_mut_bytes
for example. Depending on the size and compute power you have, this might be fast enough.Otherwise I think you're going to have to see if your lib can produce the pixels using the GPU using OpenGL and import it as a texture, like in this example.
Either way a
slint::Image
will be the target.