scale

open fun scale(x: Double = 1.0, y: Double = 1.0, block: Canvas.() -> Unit)

Linearly scales the operations within block.

canvas.scale(x = 2.0, y = 2.0)  {
rect(Rectangle(10, 10)) // Draws a rectangle that is scaled to 20 x 20
}

Parameters

x

amount to scale horizontally

y

amount to scale vertically

block

being transformed


open fun scale(around: Point, x: Double = 1.0, y: Double = 1.0, block: Canvas.() -> Unit)

Linearly scales the operations within block around the given point.

canvas.scale(around = Point(5, 5), x = 2.0, y = 2.0)  {
rect(Rectangle(10, 10)) // Draws rectangle: -5, -5, 20, 20
}

Parameters

around

this point

x

amount to scale horizontally

y

amount to scale vertically

block

being transformed