Clipping

OPENRNDR’s drawer supports a single rectangular clip mask.

fun main() = application {
    program {
        extend {
            drawer.stroke = null
            drawer.fill = ColorRGBa.PINK

            // -- set the rectangular clipping mask
            drawer.drawStyle.clip = Rectangle(100.0, 100.0, width -200.0, height - 200.00)

            drawer.circle(
                cos(seconds) * width / 2.0 + width / 2.0,
                sin(seconds) * height / 2.0 + height / 2.0,
                200.0
            )

            // -- restore clipping
            drawer.drawStyle.clip = null
        }
    }
}

Link to the full example

edit on GitHub


This site uses Just the Docs, a documentation theme for Jekyll.