Files
orx/orx-composition/src/jvmDemo/kotlin/DemoCompositionDrawer02.kt
Abe Pazos 168d1ed2d0 [orx-composition] reverse argument order in draw()
Add demos with comments
2025-08-27 11:26:35 +02:00

33 lines
968 B
Kotlin

import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.extra.composition.ClipMode
import org.openrndr.extra.composition.composition
import org.openrndr.extra.composition.drawComposition
/**
* Demonstrates how to draw a Composition and how to use
* `ClipMode.REVERSE_DIFFERENCE` to clip shapes.
*
* The first shape clips part of the second one away,
* producing a shape that seems to be behind the first one.
*
* Without clipping, the second circle would cover part of the first one.
*/
fun main() = application {
program {
val composition = drawComposition {
fill = null
circle(width / 2.0, height / 2.0, 100.0)
fill = ColorRGBa.BLACK
clipMode = ClipMode.REVERSE_DIFFERENCE
circle(width / 2.0 + 50.0, height / 2.0, 100.0)
}
extend {
drawer.clear(ColorRGBa.PINK)
drawer.composition(composition)
}
}
}