korge icon indicating copy to clipboard operation
korge copied to clipboard

renderToBitmap on stage does not save the background

Open Kietyo opened this issue 2 years ago • 2 comments

image

To replicate:

Korge(width = 512, height = 512, bgcolor = Colors.RED) {
                val views = injector.get<Views>()
                val image = solidRect(100, 100, Colors.YELLOW) {
                    rotation = maxDegrees
                    anchor(.5, .5)
                    scale(.8)
                    position(256, 256)
                }
                val ss1 = renderToBitmap(views)
                resourcesVfs["ss1.png"].writeBitmap(ss1, PNG)
}

Expectation: image

Kietyo avatar Jun 22 '22 04:06 Kietyo

The Stage is actually empty. The background clearing happens elsewhere. We could emulate it somehow as an exception. But I guess there might be cases where people might want that image with transparency, right? Should we add an optional parameter for rendering the background?

soywiz avatar Jun 22 '22 14:06 soywiz

Yeah that would be great.

Kietyo avatar Jun 22 '22 18:06 Kietyo