openrndr / org.openrndr.shape / CompositionDrawer

CompositionDrawer

class CompositionDrawer (source)

A Drawer-like interface for the creation of Compositions This should be easier than creating Compositions manually

Constructors

<init>

A Drawer-like interface for the creation of Compositions This should be easier than creating Compositions manually

CompositionDrawer(documentBounds: Rectangle = DefaultCompositionBounds, composition: Composition? = null, cursor: GroupNode? = composition?.root as? GroupNode)

Properties

clipMode

var clipMode: ClipMode

composition

val composition: Composition

cursor

var cursor: GroupNode

fill

var fill: ColorRGBa?

mask

var mask: Shape?

model

var model: Matrix44

root

val root: GroupNode

stroke

var stroke: ColorRGBa?

strokeWeight

var strokeWeight: Double

transformMode

var transformMode: TransformMode

Functions

circle

fun circle(x: Double, y: Double, radius: Double, closed: Boolean = true, insert: Boolean = true): ShapeNode?
fun circle(position: Vector2, radius: Double, closed: Boolean = true, insert: Boolean = true): ShapeNode?
fun circle(circle: Circle, closed: Boolean = true, insert: Boolean = true): ShapeNode?

circles

fun circles(circles: List<Circle>, insert: Boolean = true): List<ShapeNode?>
fun circles(positions: List<Vector2>, radius: Double, insert: Boolean = true): List<ShapeNode?>
fun circles(positions: List<Vector2>, radii: List<Double>, insert: Boolean = true): List<ShapeNode?>

contour

fun contour(contour: ShapeContour, insert: Boolean = true): ShapeNode?

contours

fun contours(contours: List<ShapeContour>, insert: Boolean = true): List<ShapeNode?>

difference

fun difference(shape: Shape, searchFrom: CompositionNode = composition.root as GroupNode): Shape

distances

Find distances to each contour in the composition tree (or starting node)

fun distances(point: Vector2, searchFrom: CompositionNode = composition.root as GroupNode): List<ShapeNodeNearestContour>fun CompositionNode.distances(point: Vector2): List<ShapeNodeNearestContour>

duplicate

Copy node and insert copy at cursor

fun CompositionNode.duplicate(insert: Boolean = true): CompositionNode

ellipse

fun ellipse(x: Double, y: Double, xRadius: Double, yRadius: Double, rotationInDegrees: Double = 0.0, closed: Boolean = true, insert: Boolean = true): ShapeNode?
fun ellipse(center: Vector2, xRadius: Double, yRadius: Double, rotationInDegrees: Double, closed: Boolean = true, insert: Boolean = true): ShapeNode?

group

Create a group node and run builder inside its context

fun group(insert: Boolean = true, id: String? = null, builder: CompositionDrawer.() -> Unit): GroupNode

image

Adds an image to the composition tree

fun image(image: ColorBuffer, x: Double = 0.0, y: Double = 0.0, insert: Boolean = true): ImageNode

intersections

Test a given contour against contours in the composition tree

fun intersections(contour: ShapeContour, searchFrom: CompositionNode = composition.root as GroupNode, mergeThreshold: Double = 0.5): List<ShapeNodeIntersection>fun CompositionNode.intersections(contour: ShapeContour, mergeThreshold: Double = 0.5): List<ShapeNodeIntersection>
fun CompositionNode.intersections(shape: Shape, mergeThreshold: Double = 0.5): List<ShapeNodeIntersection>

Test a given shape against contours in the composition tree

fun intersections(shape: Shape, searchFrom: CompositionNode = composition.root as GroupNode, mergeThreshold: Double = 0.5): List<ShapeNodeIntersection>

isolated

fun isolated(draw: CompositionDrawer.() -> Unit): Unit

lineLoop

fun lineLoop(points: List<Vector2>, insert: Boolean = true): ShapeNode?

lineSegment

fun lineSegment(startX: Double, startY: Double, endX: Double, endY: Double, insert: Boolean = true): ShapeNode?
fun lineSegment(start: Vector2, end: Vector2, insert: Boolean = true): ShapeNode?
fun lineSegment(lineSegment: LineSegment, insert: Boolean = true): ShapeNode?

lineSegments

fun lineSegments(lineSegments: List<LineSegment>, insert: Boolean = true): List<ShapeNode?>

lineStrip

fun lineStrip(points: List<Vector2>, insert: Boolean = true): ShapeNode?

nearest

Search for a point on a contour in the composition tree that's nearest to point

fun nearest(point: Vector2, searchFrom: CompositionNode = composition.root as GroupNode): ShapeNodeNearestContour?fun CompositionNode.nearest(point: Vector2): ShapeNodeNearestContour?

popModel

fun popModel(): Unit

popStyle

fun popStyle(): Unit

pushModel

fun pushModel(): Unit

pushStyle

fun pushStyle(): Unit

rectangle

fun rectangle(rectangle: Rectangle, closed: Boolean = true, insert: Boolean = true): ShapeNode?
fun rectangle(x: Double, y: Double, width: Double, height: Double, closed: Boolean = true, insert: Boolean = true): ShapeNode?

rectangles

fun rectangles(rectangles: List<Rectangle>, insert: Boolean = true): List<ShapeNode?>
fun rectangles(positions: List<Vector2>, width: Double, height: Double, insert: Boolean = true): List<ShapeNode?>
fun rectangles(positions: List<Vector2>, dimensions: List<Vector2>, insert: Boolean): List<ShapeNode?>

rotate

fun rotate(rotationInDegrees: Double): Unit
fun CompositionNode.rotate(angleInDegrees: Double, pivot: Vector2 = Vector2.ZERO): Unit

scale

fun scale(s: Double): Unit
fun scale(x: Double, y: Double): Unit
fun CompositionNode.scale(scale: Double, pivot: Vector2 = Vector2.ZERO): Unit

shape

fun shape(shape: Shape, insert: Boolean = true): ShapeNode?

shapes

fun shapes(shapes: List<Shape>, insert: Boolean = true): List<ShapeNode?>

text

fun text(text: String, position: Vector2, insert: Boolean = true): TextNode

textOnContour

fun textOnContour(text: String, contour: ShapeContour, insert: Boolean = true): TextNode

texts

fun texts(text: List<String>, positions: List<Vector2>): List<TextNode>

transform

fun CompositionNode.transform(builder: TransformBuilder.() -> Unit): Unit

translate

fun translate(x: Double, y: Double): Unit
fun translate(t: Vector2): Unit
fun CompositionNode.translate(x: Double, y: Double, z: Double = 0.0): Unit

with

fun GroupNode.with(builder: CompositionDrawer.() -> Unit): GroupNode