korge icon indicating copy to clipboard operation
korge copied to clipboard

Circles and RoundRects not rendering properly (blurry and bad strokes)

Open fredells opened this issue 1 year ago • 1 comments

Circles and RoundRects are not rendering correctly.

The below image is using the same stroke (black and 3.0 thickness) for all shapes.

Through some trial and error I determine that it seems to work if the Circle or RoundRect radius is divisible by 5.0. Clearly this is unexpected behaviour.

Screenshot 2024-01-03 at 8 55 42 AM
suspend fun main() = Korge(
    windowSize = Size(512, 512),
    backgroundColor = Colors.LIGHTGRAY) {
    val sceneContainer = sceneContainer()
    sceneContainer.changeTo({ MyScene() })
}

class MyScene : Scene() {
    override suspend fun SContainer.sceneMain() {

        val rect = roundRect(
            size = Size(80.0, 80.0),
            radius = RectCorners(4.0),
            fill = Colors.GREEN,
            stroke = Colors.BLACK,
            strokeThickness = 3.0,
        )
            .centerOnStage()

        val circle = circle(
            radius = 30f,
            fill = Colors.GREEN,
            stroke = Colors.BLACK,
            strokeThickness = 3.0
        )
            .centerOnStage()
            .alignLeftToRightOf(rect)

        val smallCircle = circle(
            radius = 28f,
            fill = Colors.GREEN,
            stroke = Colors.BLACK,
            strokeThickness = 3.0
        )
            .centerOnStage()
            .alignLeftToRightOf(circle)
    }
}

fredells avatar Jan 03 '24 13:01 fredells

Thanks for the snippet and the screenshot, that will help 👍

soywiz avatar Jan 03 '24 14:01 soywiz