CanvasRenderingContext2D

abstract external class CanvasRenderingContext2D : 
    CanvasState,
    CanvasTransform,
    CanvasCompositing,
    CanvasImageSmoothing,
    CanvasFillStrokeStyles,
    CanvasShadowStyles,
    CanvasFilters,
    CanvasRect,
    CanvasDrawPath,
    CanvasUserInterface,
    CanvasText,
    CanvasDrawImage,
    CanvasHitRegion,
    CanvasImageData,
    CanvasPathDrawingStyles,
    CanvasTextDrawingStyles,
    CanvasPath,
    RenderingContext
(source)

Platform and version requirements: JS

Exposes the JavaScript CanvasRenderingContext2D to Kotlin

Constructors

<init>

CanvasRenderingContext2D()

Exposes the JavaScript CanvasRenderingContext2D to Kotlin

Properties

canvas

open val canvas: HTMLCanvasElement

Inherited Properties

direction

abstract var direction: CanvasDirection

fillStyle

abstract var fillStyle: dynamic

filter

abstract var filter: String

font

abstract var font: String

globalAlpha

abstract var globalAlpha: Double

globalCompositeOperation

abstract var globalCompositeOperation: String

imageSmoothingEnabled

abstract var imageSmoothingEnabled: Boolean

imageSmoothingQuality

abstract var imageSmoothingQuality: ImageSmoothingQuality

lineCap

abstract var lineCap: CanvasLineCap

lineDashOffset

abstract var lineDashOffset: Double

lineJoin

abstract var lineJoin: CanvasLineJoin

lineWidth

abstract var lineWidth: Double

miterLimit

abstract var miterLimit: Double

shadowBlur

abstract var shadowBlur: Double

shadowColor

abstract var shadowColor: String

shadowOffsetX

abstract var shadowOffsetX: Double

shadowOffsetY

abstract var shadowOffsetY: Double

strokeStyle

abstract var strokeStyle: dynamic

textAlign

abstract var textAlign: CanvasTextAlign

textBaseline

abstract var textBaseline: CanvasTextBaseline

Inherited Functions

addHitRegion

abstract fun addHitRegion(
    options: HitRegionOptions = definedExternally)

arc

abstract fun arc(
    x: Double,
    y: Double,
    radius: Double,
    startAngle: Double,
    endAngle: Double,
    anticlockwise: Boolean = definedExternally)

arcTo

abstract fun arcTo(
    x1: Double,
    y1: Double,
    x2: Double,
    y2: Double,
    radius: Double)
abstract fun arcTo(
    x1: Double,
    y1: Double,
    x2: Double,
    y2: Double,
    radiusX: Double,
    radiusY: Double,
    rotation: Double)

beginPath

abstract fun beginPath()

bezierCurveTo

abstract fun bezierCurveTo(
    cp1x: Double,
    cp1y: Double,
    cp2x: Double,
    cp2y: Double,
    x: Double,
    y: Double)

clearHitRegions

abstract fun clearHitRegions()

clearRect

abstract fun clearRect(
    x: Double,
    y: Double,
    w: Double,
    h: Double)

clip

abstract fun clip(
    fillRule: CanvasFillRule = definedExternally)
abstract fun clip(
    path: Path2D,
    fillRule: CanvasFillRule = definedExternally)

closePath

abstract fun closePath()

createImageData

abstract fun createImageData(
    sw: Double,
    sh: Double
): ImageData
abstract fun createImageData(imagedata: ImageData): ImageData

createLinearGradient

abstract fun createLinearGradient(
    x0: Double,
    y0: Double,
    x1: Double,
    y1: Double
): CanvasGradient

createPattern

abstract fun createPattern(
    image: dynamic,
    repetition: String
): CanvasPattern?

createRadialGradient

abstract fun createRadialGradient(
    x0: Double,
    y0: Double,
    r0: Double,
    x1: Double,
    y1: Double,
    r1: Double
): CanvasGradient

drawFocusIfNeeded

abstract fun drawFocusIfNeeded(element: Element)
abstract fun drawFocusIfNeeded(
    path: Path2D,
    element: Element)

drawImage

abstract fun drawImage(
    image: dynamic,
    dx: Double,
    dy: Double)
abstract fun drawImage(
    image: dynamic,
    dx: Double,
    dy: Double,
    dw: Double,
    dh: Double)
abstract fun drawImage(
    image: dynamic,
    sx: Double,
    sy: Double,
    sw: Double,
    sh: Double,
    dx: Double,
    dy: Double,
    dw: Double,
    dh: Double)

ellipse

abstract fun ellipse(
    x: Double,
    y: Double,
    radiusX: Double,
    radiusY: Double,
    rotation: Double,
    startAngle: Double,
    endAngle: Double,
    anticlockwise: Boolean = definedExternally)

fill

abstract fun fill(
    fillRule: CanvasFillRule = definedExternally)
abstract fun fill(
    path: Path2D,
    fillRule: CanvasFillRule = definedExternally)

fillRect

abstract fun fillRect(
    x: Double,
    y: Double,
    w: Double,
    h: Double)

fillText

abstract fun fillText(
    text: String,
    x: Double,
    y: Double,
    maxWidth: Double = definedExternally)

getImageData

abstract fun getImageData(
    sx: Double,
    sy: Double,
    sw: Double,
    sh: Double
): ImageData

getLineDash

abstract fun getLineDash(): Array<Double>

getTransform

abstract fun getTransform(): DOMMatrix

isPointInPath

abstract fun isPointInPath(
    x: Double,
    y: Double,
    fillRule: CanvasFillRule = definedExternally
): Boolean
abstract fun isPointInPath(
    path: Path2D,
    x: Double,
    y: Double,
    fillRule: CanvasFillRule = definedExternally
): Boolean

isPointInStroke

abstract fun isPointInStroke(x: Double, y: Double): Boolean
abstract fun isPointInStroke(
    path: Path2D,
    x: Double,
    y: Double
): Boolean

lineTo

abstract fun lineTo(x: Double, y: Double)

measureText

abstract fun measureText(text: String): TextMetrics

moveTo

abstract fun moveTo(x: Double, y: Double)

putImageData

abstract fun putImageData(
    imagedata: ImageData,
    dx: Double,
    dy: Double)
abstract fun putImageData(
    imagedata: ImageData,
    dx: Double,
    dy: Double,
    dirtyX: Double,
    dirtyY: Double,
    dirtyWidth: Double,
    dirtyHeight: Double)

quadraticCurveTo

abstract fun quadraticCurveTo(
    cpx: Double,
    cpy: Double,
    x: Double,
    y: Double)

rect

abstract fun rect(x: Double, y: Double, w: Double, h: Double)

removeHitRegion

abstract fun removeHitRegion(id: String)

resetClip

abstract fun resetClip()

resetTransform

abstract fun resetTransform()

restore

abstract fun restore()

rotate

abstract fun rotate(angle: Double)

save

abstract fun save()

scale

abstract fun scale(x: Double, y: Double)

scrollPathIntoView

abstract fun scrollPathIntoView()
abstract fun scrollPathIntoView(path: Path2D)

setLineDash

abstract fun setLineDash(segments: Array<Double>)

setTransform

abstract fun setTransform(
    a: Double,
    b: Double,
    c: Double,
    d: Double,
    e: Double,
    f: Double)
abstract fun setTransform(
    transform: dynamic = definedExternally)

stroke

abstract fun stroke()
abstract fun stroke(path: Path2D)

strokeRect

abstract fun strokeRect(
    x: Double,
    y: Double,
    w: Double,
    h: Double)

strokeText

abstract fun strokeText(
    text: String,
    x: Double,
    y: Double,
    maxWidth: Double = definedExternally)

transform

abstract fun transform(
    a: Double,
    b: Double,
    c: Double,
    d: Double,
    e: Double,
    f: Double)

translate

abstract fun translate(x: Double, y: Double)