Package-level declarations

Types

Link copied to clipboard
enum class Align : Enum<Align>
Link copied to clipboard
data class AspectRatio(val align: Align, val meetOrSlice: MeetOrSlice) : AttributeOrPropertyValue
Link copied to clipboard
sealed interface AttributeOrPropertyValue
Link copied to clipboard

How far text is moved up from the baseline of its parent, like the baseline-shift property of SVG

Link copied to clipboard
enum class ClipMode : Enum<ClipMode>

Specifies in which way to combine Shapes to form a Composition

Link copied to clipboard
enum class ClipOp : Enum<ClipOp>

Used internally to define ClipModes.

Link copied to clipboard

The clip path of a node, like the clip-path property of SVG: the node is drawn where the shapes of the clip path are, with anti-aliased edges

Link copied to clipboard
class Composition(val root: CompositionNode, var bounds: CompositionDimensions = defaultCompositionDimensions)

A vector composition.

Link copied to clipboard
data class CompositionDimensions(val x: Length, val y: Length, val width: Length, val height: Length)
Link copied to clipboard
class CompositionDrawer(documentBounds: CompositionDimensions = defaultCompositionDimensions, composition: Composition? = null, cursor: GroupNode? = composition?.root as? GroupNode)

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

Link copied to clipboard

Resolves the font families of text in compositions to font files, see fontFamily, fontWeight and fontStyle. Registers in and resolves with Fonts, the fonts of all programs, which user interfaces use too.

Link copied to clipboard
class CompositionHit(val node: CompositionNode, val point: Vector2)

A node that is hit at a point: node, and point, the point in the coordinates of the node

Link copied to clipboard
class CompositionInteraction(val composition: Composition)

Interaction with a composition by the mouse, like the pointer events of SVG documents in browsers: entered and exited when the pointer moves onto or off a node and the groups it is in, pressed, released and clicked for the topmost node under the pointer. transform maps the coordinates of the composition to those of the mouse, the transform the composition is drawn with.

Link copied to clipboard
sealed class CompositionNode

Describes a node in a composition

Link copied to clipboard
class CompositionPointerEvent(val node: CompositionNode, val point: Vector2, val mouseEvent: MouseEvent?)

An event of CompositionInteraction: the node it is about, the point in the coordinates of the node, and the mouse event that caused it

Link copied to clipboard

The dash pattern of strokes, like the stroke-dasharray property of SVG

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The baseline of text that its position is on, like the dominant-baseline property of SVG. AUTO is the alphabetic baseline.

Link copied to clipboard

The rule that decides which parts of a shape with overlapping or self-intersecting contours are filled, like the fill-rule of SVG

Link copied to clipboard

the color space that a primitive computes in, like color-interpolation-filters

Link copied to clipboard
class FilterEffect(val primitives: List<FilterPrimitive>, val region: Rectangle? = Rectangle(-0.1, -0.1, 1.2, 1.2), val regionUnits: PaintUnits = PaintUnits.BOUNDS, val primitiveUnits: PaintUnits = PaintUnits.OBJECT, val id: String = "")

A filter effect, like SVG's filter element: primitives applied in order to what a node draws, in region: in the coordinates of regionUnits, or everywhere when the region is null. Lengths of primitives are in user space, or in fractions of the bounds of the node when primitiveUnits is PaintUnits.BOUNDS.

Link copied to clipboard
sealed interface FilterInput

an input of a filter primitive

Link copied to clipboard
sealed class FilterPrimitive

A primitive of a FilterEffect: it computes an image from its inputs, which is the input of the next primitive and, when it has a result name, of later primitives that refer to it. Lengths are in the units of the FilterEffect.primitiveUnits.

Link copied to clipboard

The filter effects of a node, applied one after the other, like the filter property of CSS

Link copied to clipboard
class FilterSubregion(val x: Double? = null, val y: Double? = null, val width: Double? = null, val height: Double? = null)

The subregion of a primitive, like the x, y, width and height attributes of SVG filter primitives: in the units of FilterEffect.primitiveUnits, fractions of the bounds of the node for PaintUnits.BOUNDS. A component that is null is that of the default subregion: the union of the subregions of the inputs, or the region of the filter.

Link copied to clipboard

A font face that text in a group can use, like a @font-face rule of CSS, see org.openrndr.extra.textwriter.FontFace

Link copied to clipboard

The font families of text in order of preference, like CSS font-family

Link copied to clipboard

Settings of the font, like font-feature-settings (OpenType features and their values) and font-variation-settings (axes of variable fonts and their values)

Link copied to clipboard
Link copied to clipboard

The weight of a font, from 100 (thin) to 900 (black), 400 is normal and 700 is bold

Link copied to clipboard
open class GroupNode(val children: MutableList<CompositionNode> = mutableListOf()) : CompositionNode

Represents a group node in a composition hierarchy. A GroupNode itself does not have explicit contents but serves as a container for managing child nodes. It allows grouping of multiple CompositionNode instances and provides functionalities like calculating the bounds for all its child elements and copying itself with overrides.

Link copied to clipboard

Represents a specialized type of GroupNode in a composition hierarchy, serving as a container for child nodes.

Link copied to clipboard
class ImageNode(var image: ColorBuffer, var x: Double, var y: Double, var width: Double, var height: Double, var source: Rectangle? = null) : CompositionNode

a CompositionNode that holds a single image ColorBuffer, drawn into the rectangle at (x, y) of width by height

Link copied to clipboard
Link copied to clipboard

Whether a group is drawn on its own before it is blended with what is under it, like the isolation property of CSS. Groups with an opacity, a mask or a blend mode are always isolated.

Link copied to clipboard
sealed interface Length : AttributeOrPropertyValue
Link copied to clipboard

how text is adjusted to its textLength, like the lengthAdjust attribute of SVG

Link copied to clipboard
Link copied to clipboard

the height of lines of text: normal, a multiple of the font size, or a length, like line-height

Link copied to clipboard
Link copied to clipboard
class Marker(val content: GroupNode, val viewBox: Rectangle? = null, val aspectRatio: AspectRatio = AspectRatio.DEFAULT, val reference: Vector2 = Vector2.ZERO, val size: Vector2 = Vector2(3.0, 3.0), val strokeWidthUnits: Boolean = true, val orient: MarkerOrient = MarkerOrient.Angle(0.0), val id: String = "")

A marker, like SVG's marker: content drawn at the vertices of paths. The content is in the coordinates of viewBox, fitted into size by aspectRatio, or in the coordinates of size when there is no view box; the point reference of the content is placed on the vertex. The size is multiplied by the stroke weight when strokeWidthUnits is true. Clipping the content to the viewport, as SVG does by default, is part of the content.

Link copied to clipboard
sealed interface MarkerOrient

How a Marker is turned at a vertex

Link copied to clipboard

The marker at vertices of paths, like the marker-start, marker-mid and marker-end properties of SVG

Link copied to clipboard
class Mask(val content: GroupNode, val units: PaintUnits = PaintUnits.OBJECT, val region: Rectangle? = Rectangle(-0.1, -0.1, 1.2, 1.2), val regionUnits: PaintUnits = PaintUnits.BOUNDS, val type: MaskType = MaskType.LUMINANCE, val id: String = "")

A mask, like SVG's mask: the alpha of what it is applied to is multiplied by the value of content, its luminance or its alpha by type. The content is in the coordinates of the node it is applied to, or in the bounds of that node when units is PaintUnits.BOUNDS; it is drawn in region, in the coordinates of regionUnits, or everywhere when the region is null.

Link copied to clipboard

The mask of a node, like the mask property of SVG

Link copied to clipboard
enum class MaskType : Enum<MaskType>

how the value of a Mask is taken from its content, like the mask-type property of SVG

Link copied to clipboard
Link copied to clipboard

How a node is blended with what is drawn under it, like the mix-blend-mode property of CSS. The modes are those of the W3C compositing and blending specification.

Link copied to clipboard
Link copied to clipboard

an optional length: a Length, or none, like the textLength attribute and the inline-size property

Link copied to clipboard
sealed interface Paint : AttributeOrPropertyValue
Link copied to clipboard

The order in which the fill and the stroke of shapes and text are painted, like the paint-order property of SVG

Link copied to clipboard

The length that the author gives a path, like the pathLength attribute of SVG: lengths along the path, like those of dashes, are scaled by the actual length of the path divided by value. Null for the actual length.

Link copied to clipboard

Which parts of a node are hit by the pointer, like the pointer-events property of SVG: the fill and the stroke, when they are painted or always, and only when the node is visible or always. NONE is never hit.

Link copied to clipboard
sealed interface Shade : AttributeOrPropertyValue
Link copied to clipboard
class ShapeNode(var shape: Shape) : CompositionNode

a CompositionNode that holds a single Shape

Link copied to clipboard
data class ShapeNodeIntersection(val node: ShapeNode, val intersection: ContourIntersection)

Data structure containing intersection information.

Link copied to clipboard
data class ShapeNodeNearestContour(val node: ShapeNode, val point: ContourPoint, val distanceDirection: Vector2, val distance: Double)

Data structure containing information about a point in a ShapeContour closest to some other 2D point.

Link copied to clipboard

How shapes are rendered, like the shape-rendering property of SVG: shapes are not anti-aliased with CRISP_EDGES and OPTIMIZE_SPEED

Link copied to clipboard
Link copied to clipboard
sealed class Styleable
Link copied to clipboard

Where text is placed relative to its position: the fraction of its width that is left of the position

Link copied to clipboard
class TextDecoration(val underline: Boolean = false, val overline: Boolean = false, val lineThrough: Boolean = false) : AttributeOrPropertyValue

The lines drawn along text, like the text-decoration property of CSS

Link copied to clipboard

the direction of text, like the direction property: left to right or right to left

Link copied to clipboard
data class TextNode(var text: String, var contour: ShapeContour?, var x: Double? = null, var y: Double? = null, var dx: Double = 0.0, var dy: Double = 0.0, var rotate: Double = 0.0) : CompositionNode

a CompositionNode that holds a run of text, drawn along contour or starting at a position

Link copied to clipboard

How the characters of vertical text are oriented, like the text-orientation property: MIXED sets the characters of scripts that are written vertically, like CJK, upright and turns others sideways, UPRIGHT sets all upright, SIDEWAYS turns all 90 degrees clockwise

Link copied to clipboard
Link copied to clipboard

Specifies if transformations should be kept separate or applied to the clipped object and reset to identity.

Link copied to clipboard

How the direction of text is applied in bidirectional text, like the unicode-bidi property: NORMAL follows the bidirectional algorithm, EMBED and ISOLATE embed the text in the direction of its element, the overrides set every character in that direction, PLAINTEXT takes the direction from the text

Link copied to clipboard
class UserData<T : Any>(val name: String, val initial: T)

org.openrndr.shape.UserData delegate

Link copied to clipboard

Effects on the rendering of shapes, like the vector-effect property of SVG

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

How the white space of text is handled, like the white-space property of CSS. Text in compositions is already collapsed or not, the value is kept so that it is written with the text; line feeds are line breaks of text that wraps, see inlineSize.

Link copied to clipboard

The direction that lines of text run in, like the writing-mode property: horizontally, or vertically from top to bottom; vertical lines follow each other to the left (VERTICAL_RL) or to the right (VERTICAL_LR)

Properties

Link copied to clipboard

how far text is moved up from the baseline of its parent, like baseline-shift; the shifts of groups add up

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

the color that Paint.CurrentColor refers to, like the color property of SVG

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

the target of the link that this node is in, like the href of the SVG a element it is in, null when it is in none

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

OpenType features of text, like font-feature-settings; font-variant is read into it

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

values of the axes of variable fonts, like font-variation-settings

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

the width that the text of a text element wraps to, like the inline-size property of SVG 2

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

space added after every character of text, like letter-spacing

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The lines drawn along text. Unlike CSS, where decorations are drawn in the color of the element that declares them, the lines are drawn in the fill and stroke of the text they are drawn along.

Link copied to clipboard

the length that the text of a text element or a tspan is adjusted to, see lengthAdjust

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

space added to every space between words, like word-spacing

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun Drawer.composition(composition: Composition)

Renders a vector Composition onto the Drawer. This method applies transformations, styles, and renders the hierarchy of nodes from the given Composition object.

Link copied to clipboard
fun Drawer.composition3d(composition: Composition, tolerance: Double = 0.25)

Draws composition in 3D, like composition draws it in 2D, but as triangles: fills are tessellated with openrndr-ktessellation, and strokes are made of the outlines of their segments, joins and caps in the plane of the composition, which are tessellated together so that a translucent stroke is drawn once where it overlaps itself. The composition is in the xy-plane of the model of the drawer, so it can be placed, turned and seen in perspective like any other geometry, with depth testing. Its layers are drawn in their order, without fighting over depth; when the drawer writes depth, the composition is drawn a second time to the depth buffer only.

Link copied to clipboard
fun Composition.draw(cursor: GroupNode? = this.root as? GroupNode, drawFunction: CompositionDrawer.() -> Unit)

Draws content into an existing composition using the provided drawing function.

Link copied to clipboard
fun drawComposition(documentBounds: CompositionDimensions = defaultCompositionDimensions, composition: Composition? = null, cursor: GroupNode? = composition?.root as? GroupNode, drawFunction: CompositionDrawer.() -> Unit): Composition

Draws a vector composition by applying a provided drawing function.

Link copied to clipboard
fun Program.drawComposition(documentBounds: CompositionDimensions = CompositionDimensions(0.0.pixels, 0.0.pixels, this.drawer.width.toDouble().pixels, this.drawer.height.toDouble().pixels), composition: Composition? = null, cursor: GroupNode? = composition?.root as? GroupNode, drawFunction: CompositionDrawer.() -> Unit): Composition

Draws a composition within the specified document bounds or an existing composition. This function utilizes a customizable draw function to define the drawing behavior.

fun Program.drawComposition(documentBounds: Rectangle, composition: Composition? = null, cursor: GroupNode? = composition?.root as? GroupNode, drawFunction: CompositionDrawer.() -> Unit): Composition

Draws a composition using the specified document bounds and drawing logic. Optionally, an existing composition and cursor can be passed to update or build upon them.

Link copied to clipboard

Filters a CompositionNode and its hierarchy based on the provided filter function. The method recursively applies the filter to the node and its children, creating a new hierarchy that contains only the nodes for which the filter returns true. If the filter condition fails for the root node, null is returned.

Link copied to clipboard

Finds first CompositionNode to match the given predicate.

Link copied to clipboard

Finds all CompositionNode instances in the current node hierarchy that satisfy the given filter. Traverses the hierarchy recursively, evaluating each node and its children.

Link copied to clipboard

find all descendant GroupNode nodes, including potentially this node

Link copied to clipboard

find all descendant ImageNode nodes, including potentially this node

Link copied to clipboard

find all descendant ShapeNode nodes, including potentially this node

Link copied to clipboard

Recursively finds all terminal nodes within the composition tree starting from the current node and applies the provided filter to determine which nodes to include in the result.

Link copied to clipboard
fun Composition.hitTest(point: Vector2): List<CompositionHit>

The nodes at point, topmost first, like SVG hit-testing: shapes are hit on their fill and stroke as their pointer-events allow, with their fill rule; text on the cells of its glyphs, images on their rectangle. Nodes that are not displayed, and points outside of clip paths, are not hit. Groups are not hit themselves, the nodes they contain are; CompositionNode.parent leads to them. The point is in the coordinates the composition is drawn in, those of the drawer before the composition is drawn.

Link copied to clipboard

the initial value of the property name, the value it has when it is not set and not inherited

Link copied to clipboard

true when the property name is inherited by the contents of groups

Link copied to clipboard
Link copied to clipboard

Merges two lists of ShapeNodeIntersection removing duplicates under the given threshold. Used internally by intersections.

Link copied to clipboard
fun Composition.nodeAt(point: Vector2): CompositionNode?

the topmost node at point, see hitTest, null when there is none

Link copied to clipboard

remove node from its parent CompositionNode

Link copied to clipboard
operator fun KMutableProperty0<Shade>.setValue(thisRef: Style, property: KProperty<*>, value: ShadeStyle)
Link copied to clipboard
fun transform(node: CompositionNode): Matrix44
Link copied to clipboard
fun viewportTransform(viewBox: Rectangle, viewport: Rectangle, aspectRatio: AspectRatio): Matrix44

The transform that fits viewBox into viewport following aspectRatio, like the viewBox and preserveAspectRatio attributes of SVG. An empty view box hides the contents.

Link copied to clipboard

visit this CompositionNode and all descendant nodes and execute visitor