CanvasRenderingContext2D

package js.html

Available on js

To get an object of this interface, call getContext() on a canvas element, supplying "2d" as the argument:

Documentation CanvasRenderingContext2D by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See also:

Variables

read onlycanvas:CanvasElement

fillStyle:EitherType<String, EitherType<CanvasGradient, CanvasPattern>>

filter:String

font:String

globalAlpha:Float

globalCompositeOperation:String

imageSmoothingEnabled:Bool

lineCap:String

lineDashOffset:Float

lineJoin:String

lineWidth:Float

miterLimit:Float

shadowBlur:Float

shadowColor:String

shadowOffsetX:Float

shadowOffsetY:Float

strokeStyle:EitherType<String, EitherType<CanvasGradient, CanvasPattern>>

textAlign:String

textBaseline:String

Methods

addHitRegion(?options:Null<HitRegionOptions>):Void

Throws:

null

DOMError

arc(x:Float, y:Float, radius:Float, startAngle:Float, endAngle:Float, anticlockwise:Bool = false):Void

Throws:

null

DOMError

arcTo(x1:Float, y1:Float, x2:Float, y2:Float, radius:Float):Void

Throws:

null

DOMError

beginPath():Void

bezierCurveTo(cp1x:Float, cp1y:Float, cp2x:Float, cp2y:Float, x:Float, y:Float):Void

clearHitRegions():Void

clearRect(x:Float, y:Float, w:Float, h:Float):Void

clip(path:Path2D, winding:CanvasWindingRule = NONZERO):Void

clip(winding:CanvasWindingRule = NONZERO):Void

closePath():Void

createImageData(imagedata:ImageData):ImageData

createImageData(sw:Float, sh:Float):ImageData

Throws:

null

DOMError

createLinearGradient(x0:Float, y0:Float, x1:Float, y1:Float):CanvasGradient

createPattern(image:ImageElement, repetition:String):CanvasPattern

createPattern(image:ImageElement, repetition:String):CanvasPattern

createPattern(image:CanvasElement, repetition:String):CanvasPattern

createPattern(image:VideoElement, repetition:String):CanvasPattern

createPattern(image:ImageBitmap, repetition:String):CanvasPattern

Throws:

null

DOMError

createRadialGradient(x0:Float, y0:Float, r0:Float, x1:Float, y1:Float, r1:Float):CanvasGradient

Throws:

null

DOMError

drawCustomFocusRing(element:Element):Bool

drawFocusIfNeeded(element:Element):Void

Throws:

null

DOMError

drawImage(image:ImageElement, sx:Float, sy:Float, sw:Float, sh:Float, dx:Float, dy:Float, dw:Float, dh:Float):Void

drawImage(image:ImageElement, dx:Float, dy:Float):Void

drawImage(image:CanvasElement, dx:Float, dy:Float):Void

drawImage(image:VideoElement, dx:Float, dy:Float):Void

drawImage(image:ImageBitmap, dx:Float, dy:Float):Void

drawImage(image:ImageElement, dx:Float, dy:Float, dw:Float, dh:Float):Void

drawImage(image:CanvasElement, dx:Float, dy:Float, dw:Float, dh:Float):Void

drawImage(image:VideoElement, dx:Float, dy:Float, dw:Float, dh:Float):Void

drawImage(image:ImageBitmap, dx:Float, dy:Float, dw:Float, dh:Float):Void

drawImage(image:ImageElement, sx:Float, sy:Float, sw:Float, sh:Float, dx:Float, dy:Float, dw:Float, dh:Float):Void

drawImage(image:CanvasElement, sx:Float, sy:Float, sw:Float, sh:Float, dx:Float, dy:Float, dw:Float, dh:Float):Void

drawImage(image:VideoElement, sx:Float, sy:Float, sw:Float, sh:Float, dx:Float, dy:Float, dw:Float, dh:Float):Void

drawImage(image:ImageBitmap, sx:Float, sy:Float, sw:Float, sh:Float, dx:Float, dy:Float, dw:Float, dh:Float):Void

drawImage(image:ImageElement, dx:Float, dy:Float):Void

drawImage(image:ImageElement, dx:Float, dy:Float, dw:Float, dh:Float):Void

Throws:

null

DOMError

ellipse(x:Float, y:Float, radiusX:Float, radiusY:Float, rotation:Float, startAngle:Float, endAngle:Float, anticlockwise:Bool = false):Void

Throws:

null

DOMError

fill(path:Path2D, winding:CanvasWindingRule = NONZERO):Void

fill(winding:CanvasWindingRule = NONZERO):Void

fillRect(x:Float, y:Float, w:Float, h:Float):Void

fillText(text:String, x:Float, y:Float, ?maxWidth:Float):Void

Throws:

null

DOMError

getImageData(sx:Float, sy:Float, sw:Float, sh:Float):ImageData

Throws:

null

DOMError

getLineDash():Array<Float>

isPointInPath(path:Path2D, x:Float, y:Float, winding:CanvasWindingRule = NONZERO):Bool

isPointInPath(x:Float, y:Float, winding:CanvasWindingRule = NONZERO):Bool

isPointInStroke(path:Path2D, x:Float, y:Float):Bool

isPointInStroke(x:Float, y:Float):Bool

lineTo(x:Float, y:Float):Void

measureText(text:String):TextMetrics

Throws:

null

DOMError

moveTo(x:Float, y:Float):Void

putImageData(imagedata:ImageData, dx:Float, dy:Float, dirtyX:Float, dirtyY:Float, dirtyWidth:Float, dirtyHeight:Float):Void

putImageData(imagedata:ImageData, dx:Float, dy:Float):Void

Throws:

null

DOMError

quadraticCurveTo(cpx:Float, cpy:Float, x:Float, y:Float):Void

rect(x:Float, y:Float, w:Float, h:Float):Void

removeHitRegion(id:String):Void

resetTransform():Void

Throws:

null

DOMError

restore():Void

rotate(angle:Float):Void

Throws:

null

DOMError

save():Void

scale(x:Float, y:Float):Void

Throws:

null

DOMError

setLineDash(segments:Array<Float>):Void

Throws:

null

DOMError

setTransform(a:Float, b:Float, c:Float, d:Float, e:Float, f:Float):Void

Throws:

null

DOMError

stroke(path:Path2D):Void

stroke():Void

strokeRect(x:Float, y:Float, w:Float, h:Float):Void

strokeText(text:String, x:Float, y:Float, ?maxWidth:Float):Void

Throws:

null

DOMError

transform(a:Float, b:Float, c:Float, d:Float, e:Float, f:Float):Void

Throws:

null

DOMError

translate(x:Float, y:Float):Void

Throws:

null

DOMError

© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/CanvasRenderingContext2D.html