openrndr / org.openrndr.draw / Drawer

Drawer

class Drawer

Constructors

<init>

Drawer(driver: Driver)

Properties

bounds

val bounds: Rectangle

context

val context: DrawContext

cullTestPass

var cullTestPass: CullTestPass

depthTestPass

var depthTestPass: DepthTestPass

depthWrite

var depthWrite: Boolean

drawStyle

var drawStyle: DrawStyle

driver

val driver: Driver

fill

var fill: ColorRGBa?

fontMap

var fontMap: FontMap?

height

var height: Int

lineCap

var lineCap: LineCap

lineJoin

var lineJoin: LineJoin

model

var model: Matrix44

projection

var projection: Matrix44

shadeStyle

var shadeStyle: ShadeStyle?

stroke

var stroke: ColorRGBa?

strokeWeight

var strokeWeight: Double

view

var view: Matrix44

width

var width: Int

Functions

background

fun background(r: Double, g: Double, b: Double, a: Double): Unit
fun background(color: ColorRGBa): Unit

circle

fun circle(x: Double, y: Double, radius: Double): Unit
fun circle(position: Vector2, radius: Double): Unit
fun circle(circle: Circle): Unit

circles

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

composition

fun composition(composition: Composition): Unit

Draws a Composition

contour

fun contour(contour: ShapeContour): Unit

Draws a single ShapeContour using fill, stroke and strokeWeight settings

contours

fun contours(contours: List<ShapeContour>): Unit

Draws contours using fill, stroke and strokeWeight settings

image

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

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

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

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

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

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

fun image(colorBuffer: ColorBuffer): Unit

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

fun image(colorBuffer: ColorBuffer, rectangles: List<Pair<Rectangle, Rectangle>>): Unit

lineLoop

fun lineLoop(points: List<Vector2>): Unit
fun lineLoop(points: List<Vector3>): Unit

lineLoops

fun lineLoops(loops: List<List<Vector2>>): Unit
fun lineLoops(loops: List<List<Vector3>>): Unit
fun lineLoops(loops: List<List<Vector2>>, weights: List<Double>): Unit
fun lineLoops(loops: List<List<Vector3>>, weights: List<Double>): Unit

lineSegment

fun lineSegment(x0: Double, y0: Double, x1: Double, y1: Double): Unit
fun lineSegment(lineSegment: LineSegment): Unitfun lineSegment(start: Vector2, end: Vector2): Unit

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

fun lineSegment(start: Vector3, end: Vector3): Unit

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

lineSegments

fun lineSegments(segments: List<Vector2>): Unit
fun lineSegments(segments: List<Vector2>, weights: List<Double>): Unit
fun lineSegments(segments: List<Vector3>): Unit
fun lineSegments(segments: List<Vector3>, weights: List<Double>): Unit

lineStrip

fun lineStrip(points: List<Vector2>): Unit

Draws a line strip with 2d coordinates

fun lineStrip(points: List<Vector3>): Unit

Draws a line strip with 3d coordinates

lineStrips

fun lineStrips(strips: List<List<Vector2>>): Unit
fun lineStrips(strips: List<List<Vector3>>): Unit

Draws line strips with 3d coordinates

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

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

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

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

lookAt

fun lookAt(from: Vector3, to: Vector3, up: Vector3 = Vector3.UNIT_Y): Unit

ortho

fun ortho(renderTarget: RenderTarget): Unitfun ortho(): Unit

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

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

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

perspective

fun perspective(fovY: Double, aspectRatio: Double, zNear: Double, zFar: Double): Unit

Sets the projection to a perspective projection matrix

popModel

fun popModel(): Unit

popProjection

fun popProjection(): Unit

popStyle

fun popStyle(): Unit

popTransforms

fun popTransforms(): Unit

popView

fun popView(): Unit

pushModel

fun pushModel(): Matrix44

pushProjection

fun pushProjection(): Matrix44

pushStyle

fun pushStyle(): DrawStyle

pushTransforms

fun pushTransforms(): Unit

pushView

fun pushView(): Matrix44

rectangle

fun rectangle(rectangle: Rectangle): Unit
fun rectangle(x: Double, y: Double, width: Double, height: Double): Unit
fun rectangle(corner: Vector2, width: Double, height: Double): Unit

rectangles

fun rectangles(positions: List<Vector2>, width: Double, height: Double): Unit
fun rectangles(positions: List<Vector2>, dimensions: List<Vector2>): Unit
fun rectangles(rectangles: List<Rectangle>): Unit

reset

fun reset(): Unit

rotate

fun rotate(rotationInDegrees: Double): Unit
fun rotate(axis: Vector3, rotationInDegrees: Double): Unit

scale

fun scale(s: Double): Unit
fun scale(x: Double, y: Double): Unit
fun scale(x: Double, y: Double, z: Double): Unit

shape

fun shape(shape: Shape): Unit

Draws a single Shape using fill, stroke and strokeWeight settings

shapes

fun shapes(shapes: List<Shape>): Unit

Draws shapes using fill, stroke and strokeWeight settings

size

fun size(width: Int, height: Int): Unit

text

fun text(text: String, position: Vector2): Unit

Draws text at (position)

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

Draws text at (x, y)

texts

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

Draws texts at positions)

translate

fun translate(t: Vector2): Unit
fun translate(t: Vector3): Unit
fun translate(x: Double, y: Double): Unit
fun translate(x: Double, y: Double, z: Double): Unit

vertexBuffer

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

Draws a VertexBuffer using primitive

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

vertexBufferInstances

fun vertexBufferInstances(vertexBuffers: List<VertexBuffer>, instanceAttributes: List<VertexBuffer>, primitive: DrawPrimitive, instanceCount: Int, offset: Int = 0, vertexCount: Int = vertexBuffers[0].vertexCount): Unit
fun vertexBufferInstances(indexBuffer: IndexBuffer, vertexBuffers: List<VertexBuffer>, instanceAttributes: List<VertexBuffer>, primitive: DrawPrimitive, instanceCount: Int, offset: Int = 0, indexCount: Int = indexBuffer.indexCount): Unit

withTarget

fun withTarget(target: RenderTarget, action: Drawer.() -> Unit): Unit

Extension Functions

isolated

fun Drawer.isolated(function: Drawer.() -> Unit): Unit

Pushes style, view- and projection matrix, calls function and pops.

isolatedWithTarget

fun Drawer.isolatedWithTarget(target: RenderTarget, function: Drawer.() -> Unit): Unit

Pushes style, view- and projection matrix, sets render target, calls function and pops,