HtmlKanvas

class HtmlKanvas(element: HTMLCanvasElement, scalingFactor: Float = 1.0f) : Kanvas, IsPointInPath

Constructors

Link copied to clipboard
constructor(element: HTMLCanvasElement, scalingFactor: Float = 1.0f)

Properties

Link copied to clipboard

The raw HTMLCanvas's 2d rendering context.

Link copied to clipboard
open override val height: Float

Gets the height of the canvas.

Link copied to clipboard
open override val width: Float

Gets the width of the canvas.

Functions

Link copied to clipboard
open override fun drawArc(left: Float, top: Float, right: Float, bottom: Float, startAngle: Float, sweepAngle: Float, paint: Paint)

Draw an arc that fits in the oval defined by the rectangle left, top, right, and bottom, from startAngle (in degrees, with 0 at the right) to startAngle + sweepAngle.

Link copied to clipboard
open override fun drawCircle(centerX: Float, centerY: Float, radius: Float, paint: Paint)

Draw a circle at centerX, centerY with size defined by its radius.

Link copied to clipboard
open override fun drawColor(color: Color)

Draw a color over the entire canvas. Implementations may or may not restrict this to the current clip.

Link copied to clipboard
open override fun drawLine(startX: Float, startY: Float, endX: Float, endY: Float, paint: Paint)

Draw a line from startX, startY to endX, endY.

Link copied to clipboard
open override fun drawOval(left: Float, top: Float, right: Float, bottom: Float, paint: Paint)

Draw an oval defined by the rectangle left, top, right, and bottom.

Link copied to clipboard
open override fun drawPath(path: Path, paint: Paint)

Draws a Path.

Link copied to clipboard
open override fun drawRect(left: Float, top: Float, right: Float, bottom: Float, paint: Paint)

Draws the rectangle left, top, right, bottom.

Link copied to clipboard
open override fun drawText(text: CharSequence, x: Float, y: Float, paint: Paint)

Draws a string of text at x, y. Exact horizontal behavior is controlled by the paint's alignment.

Link copied to clipboard
open override fun isPointInPath(transform: Transform, path: Path, x: Float, y: Float): Boolean
Link copied to clipboard
open override fun pop()

Removes the last pushClip or pushTransform operation.

Link copied to clipboard
open override fun pushClip(clip: Clip)

Pushes a clip to the canvas. Remove it with pop.

Link copied to clipboard
open override fun pushTransform(transform: Transform)

Pushes a transform to the canvas. Remove it with pop.

Link copied to clipboard
inline fun Kanvas.withClip(clip: Clip, actions: Kanvas.() -> Unit)

Invokes actions inside of a Kanvas.pushClip/Kanvas.pop pair.

Link copied to clipboard
inline fun Kanvas.withTransform(transform: Transform, actions: Kanvas.() -> Unit)

Invokes actions inside of a Kanvas.pushTransform/Kanvas.pop pair.