[orx-composition] reverse argument order in draw()

Add demos with comments
This commit is contained in:
Abe Pazos
2025-08-27 11:26:35 +02:00
parent bbb243bc63
commit 168d1ed2d0
6 changed files with 151 additions and 21 deletions

View File

@@ -3,10 +3,22 @@ import org.openrndr.color.ColorRGBa
import org.openrndr.extra.composition.ClipMode
import org.openrndr.extra.composition.composition
import org.openrndr.extra.composition.drawComposition
import org.openrndr.extra.svg.saveToFile
import java.io.File
/**
* Draws a composition using 3 circles and `ClipMode.REVERSE_DIFFERENCE`.
*
* A println() demonstrates that the result contains 3 shapes:
* a complete circle, a moon-like shape, and a shape with two small black areas.
*
* One way to verify this is by saving the design as an SVG file and opening
* it in vector editing software.
*
*/
fun main() = application {
program {
val cd = drawComposition {
val composition = drawComposition {
fill = null
clipMode = ClipMode.REVERSE_DIFFERENCE
@@ -17,9 +29,14 @@ fun main() = application {
circle(width / 2.0, height / 2.0, 100.0)
}
println(composition.findShapes().size)
// save svg to a File
//composition.saveToFile(File("/path/to/design.svg"))
extend {
drawer.clear(ColorRGBa.PINK)
drawer.composition(cd)
drawer.composition(composition)
}
}
}