How do I get raw pixel buffer from SkImage

85 views
Skip to first unread message

render dender

unread,
Mar 12, 2025, 7:13:05 AM3/12/25
to skia-discuss
I've got an SkSurface. I get SkCanvas from this surface and draw some commands into it. Afer that I get SkImage with `SkSurface.makeImageSnapshot()'.

Now I want to get the raw pixel buffer from it. How do I do that? 
I tried using SkPngEncoder::Encode() to save the rendered image into the file just to check that everything works and it does. Now I want to get the rgba buffer instead of encoding it to use further in my engine. What's the easiest wat to do that?

Maybe it's something obvious, but I still haven't figured it out.


___
Thanks,
Denis

mattl...@live.com

unread,
Apr 15, 2025, 3:19:30 PM4/15/25
to skia-discuss
Isn't there a peekPixels or something?
Reply all
Reply to author
Forward
0 new messages