Drawer

class Drawer(val driver: Driver)(source)

The Drawer

Constructors

Link copied to clipboard
constructor(driver: Driver)

Functions

Link copied to clipboard
fun circle(circle: Circle)
fun circle(position: Vector2, radius: Double)

fun circle(x: Double, y: Double, radius: Double)

Draw a circle

Link copied to clipboard

Create a stored batch of circles

Link copied to clipboard
fun circles(build: CircleBatchBuilder.() -> Unit)

Create and draw batched circles

fun circles(circles: List<Circle>)
fun circles(positions: List<Vector2>, radius: Double)
fun circles(positions: List<Vector2>, radii: List<Double>)

fun circles(batch: CircleBatch, count: Int = batch.size)

Draw stored circle batch

Link copied to clipboard
fun clear(color: ColorRGBa)
fun clear(r: Double, g: Double, b: Double, a: Double)
Link copied to clipboard
fun contour(contour: ShapeContour)

Draws a single ShapeContour using fill, stroke and strokeWeight settings

Link copied to clipboard
fun contours(contours: List<ShapeContour>)

Draws org.openrndr.shape.contours using fill, stroke and strokeWeight settings

Link copied to clipboard
fun defaults()

Loads default values for draw style and transformations

Link copied to clipboard
fun image(colorBuffer: ColorBuffer)

Draws an image with its top-left corner at (0,0)

fun image(colorBuffer: ColorBuffer, rectangles: List<Pair<Rectangle, Rectangle>>)
fun image(arrayTexture: ArrayTexture, layers: List<Int>, rectangles: List<Pair<Rectangle, Rectangle>>)
fun image(arrayTexture: ArrayTexture, layer: Int = 0, source: Rectangle, target: Rectangle)

fun image(colorBuffer: ColorBuffer, target: Rectangle)

Draws an image (ColorBuffer) into a target area

fun image(colorBuffer: ColorBuffer, source: Rectangle, target: Rectangle)

Draws a source area of an image (ColorBuffer) into a target area

fun image(colorBuffer: ColorBuffer, position: Vector2, width: Double = colorBuffer.width.toDouble(), height: Double = colorBuffer.height.toDouble())

Draws an image with its top-left corner at (position) and dimensions (width, height)

fun image(colorBuffer: ColorBuffer, x: Double, y: Double, width: Double = colorBuffer.width.toDouble(), height: Double = colorBuffer.height.toDouble())

Draws an image with its top-left corner at (x, y) and dimensions (width, height)

fun image(arrayTexture: ArrayTexture, layer: Int = 0, x: Double = 0.0, y: Double = 0.0, width: Double = arrayTexture.width.toDouble(), height: Double = arrayTexture.height.toDouble())

Draws an image using an ArrayTexture as source

Link copied to clipboard
fun Drawer.isolated(function: Drawer.() -> Unit)

Pushes style and model-view-projection matrices, calls function and pops.

Link copied to clipboard
fun Drawer.isolatedWithTarget(target: RenderTarget, function: Drawer.() -> Unit)

Pushes style and model-view-projection matrices, sets render target, calls function and pops.

Link copied to clipboard
fun lineLoop(points: List<Vector2>)
@JvmName(name = "lineLoop3d")
fun lineLoop(points: List<Vector3>)
Link copied to clipboard
fun lineLoops(loops: List<List<Vector2>>)
@JvmName(name = "lineLoops3d")
fun lineLoops(loops: List<List<Vector3>>)
fun lineLoops(loops: List<List<Vector2>>, weights: List<Double>)
@JvmName(name = "lineLoops3d)")
fun lineLoops(loops: List<List<Vector3>>, weights: List<Double>)
Link copied to clipboard
fun lineSegment(lineSegment: LineSegment)
fun lineSegment(x0: Double, y0: Double, x1: Double, y1: Double)

fun lineSegment(start: Vector2, end: Vector2)

Draws a line segment from start to end using 2d coordinates

fun lineSegment(start: Vector3, end: Vector3)

Draws a line segment from start to end using 3d coordinates

Link copied to clipboard
fun lineSegments(segments: List<Vector2>)
@JvmName(name = "lineSegments3d")
fun lineSegments(segments: List<Vector3>)
@JvmName(name = "lineSegmentsFromLineSegmentList")
fun lineSegments(segments: List<LineSegment>)
fun lineSegments(segments: List<Vector2>, weights: List<Double>)
@JvmName(name = "lineSegments3d")
fun lineSegments(segments: List<Vector3>, weights: List<Double>)
@JvmName(name = "lineSegments3d")
fun lineSegments(segments: List<Vector3>, weights: List<Double>, colors: List<ColorRGBa>)
Link copied to clipboard
fun lineStrip(points: List<Vector2>)

Draws a line strip with 2d coordinates

@JvmName(name = "lineStrip3d")
fun lineStrip(points: List<Vector3>)

Draws a line strip with 3d coordinates

Link copied to clipboard
fun lineStrips(strips: List<List<Vector2>>)
@JvmName(name = "lineStrips3d")
fun lineStrips(strips: List<List<Vector3>>)

Draws line strips with 3d coordinates

fun lineStrips(strips: List<List<Vector2>>, weights: List<Double>)

Draws line strips with 2d coordinates and stroke weights per strip

@JvmName(name = "lineStrips3d")
fun lineStrips(strips: List<List<Vector3>>, weights: List<Double>)
@JvmName(name = "lineStrips3d")
fun lineStrips(strips: List<List<Vector3>>, weights: List<Double>, colors: List<ColorRGBa>)

Draws line strips with 3d coordinates and stroke weights per strip

Link copied to clipboard
fun lookAt(from: Vector3, to: Vector3, up: Vector3 = Vector3.UNIT_Y, target: TransformTarget = TransformTarget.VIEW)
Link copied to clipboard
fun ortho()

Sets the projection matrix to orthogonal using the drawer's current size

fun ortho(renderTarget: RenderTarget)

Sets the projection matrix to orthogonal using the sizes of a RenderTarget

fun ortho(left: Double, right: Double, bottom: Double, top: Double, near: Double, far: Double)

Sets the projection matrix to orthogonal using left, right, bottom, top, near, far

Link copied to clipboard
fun path(path: Path3D)

Draws a single 3D path

Link copied to clipboard
fun perspective(fovY: Double, aspectRatio: Double, zNear: Double, zFar: Double)

Sets the projection to a perspective projection matrix

Link copied to clipboard
fun point(vector: Vector2)
fun point(vector: Vector3)
fun point(x: Double, y: Double, z: Double = 0.0)

Draw a single point

Link copied to clipboard

Create a stored batch of points

Link copied to clipboard
fun points(build: PointBatchBuilder.() -> Unit)

Create and draw batched points

@JvmName(name = "points2D")
fun points(points: List<Vector2>)

Draw a list of 2D points

@JvmName(name = "points3D")
fun points(points: List<Vector3>)

Draw a list of 3D points

fun points(batch: PointBatch, count: Int = batch.size)

Draw a stored batch of points

Link copied to clipboard
fun popModel()
Link copied to clipboard

Pop the active projection matrix from the projection state stack

Link copied to clipboard
fun popStyle()

Pop the draw style from the draw style stack

Link copied to clipboard

Pop the active the model, view and projection matrices from their respective stacks

Link copied to clipboard
fun popView()
Link copied to clipboard
Link copied to clipboard

Push the active projection matrix on the projection state stack

Link copied to clipboard

Push the active draw style on the draw style stack

Link copied to clipboard

Push the active model, view and projection matrices on their respective stacks

Link copied to clipboard
Link copied to clipboard
fun rectangle(rectangle: Rectangle)
fun rectangle(corner: Vector2, width: Double, height: Double = width)
fun rectangle(x: Double, y: Double, width: Double, height: Double = width)
Link copied to clipboard

Create a stored batch of rectangles

Link copied to clipboard

Create and draw batched rectangles

fun rectangles(rectangles: List<Rectangle>)
fun rectangles(positions: List<Vector2>, dimensions: List<Vector2>)
fun rectangles(batch: RectangleBatch, count: Int = batch.size)
fun rectangles(positions: List<Vector2>, width: Double, height: Double = width)
Link copied to clipboard
fun rotate(rotationInDegrees: Double, target: TransformTarget = TransformTarget.MODEL)

Applies a rotation over the z-axis to the model matrix

fun rotate(axis: Vector3, rotationInDegrees: Double, target: TransformTarget = TransformTarget.MODEL)

Applies a rotation over an arbitrary axis to the model matrix

Link copied to clipboard
fun scale(s: Double, target: TransformTarget = TransformTarget.MODEL)

Apply a uniform scale to the model matrix

fun scale(x: Double, y: Double, target: TransformTarget = TransformTarget.MODEL)
fun scale(x: Double, y: Double, z: Double, target: TransformTarget = TransformTarget.MODEL)

Applies non-uniform scale to the model matrix

Link copied to clipboard
fun segment(segment: Segment2D)

Draw a single segment

fun segment(segment: Segment3D)

Draws a single 3D segment

Link copied to clipboard
@JvmName(name = "segments2d")
fun segments(segments: List<Segment2D>)

Draws a list of 2D segments

fun segments(segments: List<Segment3D>)

Draws a list of 3D segments

fun segments(segments: List<Segment3D>, weights: List<Double>, colors: List<ColorRGBa>)

Draws a list of 3D segments, each with their weight and color

Link copied to clipboard
fun shape(shape: Shape)

Draws a single Shape using fill, stroke and strokeWeight settings

Link copied to clipboard
fun shapes(shapes: List<Shape>)

Draws shapes using fill, stroke and strokeWeight settings

Link copied to clipboard
fun text(text: String, position: Vector2)

Draws text at (position)

fun text(text: String, x: Double = 0.0, y: Double = 0.0)

Draws text at (x, y)

Link copied to clipboard
fun texts(texts: List<String>, positions: List<Vector2>)

Draws texts at positions)

Link copied to clipboard
Link copied to clipboard
fun translate(t: Vector2, target: TransformTarget = TransformTarget.MODEL)
fun translate(x: Double, y: Double, target: TransformTarget = TransformTarget.MODEL)

Applies a two-dimensional translation to the model matrix

fun translate(t: Vector3, target: TransformTarget = TransformTarget.MODEL)

Applies three-dimensional translation to the model matrix

fun translate(x: Double, y: Double, z: Double, target: TransformTarget = TransformTarget.MODEL)

Applies a three-dimensional translation to the model matrix

Link copied to clipboard
fun vertexBuffer(vertexBuffers: List<VertexBuffer>, primitive: DrawPrimitive, offset: Int = 0, vertexCount: Int = vertexBuffers[0].vertexCount)
fun vertexBuffer(indexBuffer: IndexBuffer, vertexBuffers: List<VertexBuffer>, primitive: DrawPrimitive, offset: Int = 0, indexCount: Int = indexBuffer.indexCount)

fun vertexBuffer(vertexBuffer: VertexBuffer, primitive: DrawPrimitive, vertexOffset: Int = 0, vertexCount: Int = vertexBuffer.vertexCount)

Draws a VertexBuffer using primitive

Link copied to clipboard
fun vertexBufferInstances(vertexBuffers: List<VertexBuffer>, instanceAttributes: List<VertexBuffer>, primitive: DrawPrimitive, instanceCount: Int, offset: Int = 0, vertexCount: Int = vertexBuffers[0].vertexCount)
fun vertexBufferInstances(indexBuffer: IndexBuffer, vertexBuffers: List<VertexBuffer>, instanceAttributes: List<VertexBuffer>, primitive: DrawPrimitive, instanceCount: Int, offset: Int = 0, indexCount: Int = indexBuffer.indexCount)
Link copied to clipboard
fun withTarget(target: RenderTarget, action: Drawer.() -> Unit)

Properties

Link copied to clipboard

The bounds of the drawable area as a Rectangle

Link copied to clipboard

The draw context holds references to model, view, projection matrices, width, height and content-scale

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 active fill color

Link copied to clipboard

The active fontmap, default is null

Link copied to clipboard
val height: Int
Link copied to clipboard

The active line cap method

Link copied to clipboard

The active line join method

Link copied to clipboard

When two line segments meet at a sharp angle and miter joins have been specified for lineJoin, it is possible for the miter to extend far beyond the thickness of the line stroking the path. The miterlimit imposes a limit on the ratio of the miter length to the strokeWeight.

Link copied to clipboard

The active model matrix

Link copied to clipboard

The active projection matrix

Link copied to clipboard
Link copied to clipboard

The active stroke color

Link copied to clipboard

The active stroke weight

Link copied to clipboard

The active view matrix

Link copied to clipboard
val width: Int