humbleui 2022-09-26

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

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!