Fork me on GitHub
#humbleui
<
2022-09-26
>
chromalchemy17:09:30

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)

Niki12:09:42

You can get image with (-> canvas .getSurface .makeImageSnapshot)

Niki12:09:45

Then (-> image (.encodeToData EncodedImageFormat/PNG) .getBytes)

Niki12:09:00

and save to file

chromalchemy12:09:04

Thanks. And you apply that to any element, or to the “window”?

Niki14:09:39

You get canvas inside -draw method in a component

Niki14:09:25

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

chromalchemy22:09:03

Ok will try it out, thanks!