Can I save a Humbleui window, or sub-rect as a bitmap/png programmatically?
I see there there might be something close to ..
(-> app event surface canvas .saveScreenshot)
You can get image with (-> canvas .getSurface .makeImageSnapshot)
Then (-> image (.encodeToData EncodedImageFormat/PNG) .getBytes)
and save to file
Thanks. And you apply that to any element, or to the “window”?
You get canvas inside -draw method in a component
If you start from window, well, take a look at this example https://github.com/HumbleUI/Skija/blob/ad8c71118d2758cbd8fa1b4509c6bb228257ba05/examples/bitmap/src/RenderToBitmap.java
One option might be to create surface in memory, take canvas from it and the render app on that surface instead of one allocated by JWM
Ok will try it out, thanks!