CanvasRenderingContext2D
js.html.CanvasRenderingContext2D (extern class)
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:
Instance Members
canvas: CanvasElement
globalAlpha: Float
globalCompositeOperation: String
strokeStyle: haxe.extern.EitherType<String, haxe.extern.EitherType<CanvasGradient, CanvasPattern>>
filter: String
imageSmoothingEnabled: Bool
lineWidth: Float
lineCap: String
lineJoin: String
miterLimit: Float
lineDashOffset: Float
shadowOffsetX: Float
shadowOffsetY: Float
shadowBlur: Float
shadowColor: String
font: String
textAlign: String
textBaseline: String
drawImage(image: ImageElement, sx: Float, sy: Float, sw: Float, sh: Float, dx: Float, dy: Float, dw: Float, dh: Float): Void
Name | Type |
---|---|
image |
ImageElement |
sx |
Float |
sy |
Float |
sw |
Float |
sh |
Float |
dx |
Float |
dy |
Float |
dw |
Float |
dh |
Float |
beginPath(): Void
fill(path: Path2D, ?winding: CanvasWindingRule = NONZERO): Void
Name | Type | Default |
---|---|---|
path |
Path2D | |
winding |
CanvasWindingRule | NONZERO |
Name | Type |
---|---|
path |
Path2D |
clip(path: Path2D, ?winding: CanvasWindingRule = NONZERO): Void
Name | Type | Default |
---|---|---|
path |
Path2D | |
winding |
CanvasWindingRule | NONZERO |
isPointInPath(path: Path2D, x: Float, y: Float, ?winding: CanvasWindingRule = NONZERO): Bool
Name | Type | Default |
---|---|---|
path |
Path2D | |
x |
Float | |
y |
Float | |
winding |
CanvasWindingRule | NONZERO |
Returns |
---|
Bool |
Name | Type |
---|---|
path |
Path2D |
x |
Float |
y |
Float |
Returns |
---|
Bool |
createLinearGradient(x0: Float, y0: Float, x1: Float, y1: Float): CanvasGradient
Name | Type |
---|---|
x0 |
Float |
y0 |
Float |
x1 |
Float |
y1 |
Float |
Returns |
---|
CanvasGradient |
createRadialGradient(x0: Float, y0: Float, r0: Float, x1: Float, y1: Float, r1: Float): CanvasGradient
Name | Type |
---|---|
x0 |
Float |
y0 |
Float |
r0 |
Float |
x1 |
Float |
y1 |
Float |
r1 |
Float |
Returns |
---|
CanvasGradient |
createPattern(image: ImageElement, repetition: String): CanvasPattern
Name | Type |
---|---|
image |
ImageElement |
repetition |
String |
Returns |
---|
CanvasPattern |
addHitRegion(?options: Null<HitRegionOptions>): Void
Name | Type | Default |
---|---|---|
options |
Null<HitRegionOptions> | (optional) |
Name | Type |
---|---|
id |
String |
clearHitRegions(): Void
Name | Type |
---|---|
imagedata |
ImageData |
Returns |
---|
ImageData |
Name | Type |
---|---|
sx |
Float |
sy |
Float |
sw |
Float |
sh |
Float |
Returns |
---|
ImageData |
putImageData(imagedata: ImageData, dx: Float, dy: Float, dirtyX: Float, dirtyY: Float, dirtyWidth: Float, dirtyHeight: Float): Void
Name | Type |
---|---|
imagedata |
ImageData |
dx |
Float |
dy |
Float |
dirtyX |
Float |
dirtyY |
Float |
dirtyWidth |
Float |
dirtyHeight |
Float |
Name | Type |
---|---|
segments |
Array<Float> |
Returns |
---|
Array<Float> |
closePath(): Void
Name | Type |
---|---|
x |
Float |
y |
Float |
Name | Type |
---|---|
x |
Float |
y |
Float |
Name | Type |
---|---|
cpx |
Float |
cpy |
Float |
x |
Float |
y |
Float |
Name | Type |
---|---|
cp1x |
Float |
cp1y |
Float |
cp2x |
Float |
cp2y |
Float |
x |
Float |
y |
Float |
Name | Type |
---|---|
x1 |
Float |
y1 |
Float |
x2 |
Float |
y2 |
Float |
radius |
Float |
Name | Type |
---|---|
x |
Float |
y |
Float |
w |
Float |
h |
Float |
arc(x: Float, y: Float, radius: Float, startAngle: Float, endAngle: Float, ?anticlockwise: Bool = false): Void
Name | Type | Default |
---|---|---|
x |
Float | |
y |
Float | |
radius |
Float | |
startAngle |
Float | |
endAngle |
Float | |
anticlockwise |
Bool | false |
ellipse(x: Float, y: Float, radiusX: Float, radiusY: Float, rotation: Float, startAngle: Float, endAngle: Float, ?anticlockwise: Bool = false): Void
Name | Type | Default |
---|---|---|
x |
Float | |
y |
Float | |
radiusX |
Float | |
radiusY |
Float | |
rotation |
Float | |
startAngle |
Float | |
endAngle |
Float | |
anticlockwise |
Bool | false |
Name | Type |
---|---|
x |
Float |
y |
Float |
w |
Float |
h |
Float |
Name | Type |
---|---|
x |
Float |
y |
Float |
w |
Float |
h |
Float |
Name | Type |
---|---|
x |
Float |
y |
Float |
w |
Float |
h |
Float |
save(): Void
restore(): Void
Name | Type | Default |
---|---|---|
text |
String | |
x |
Float | |
y |
Float | |
maxWidth |
Float | (optional) |
Name | Type | Default |
---|---|---|
text |
String | |
x |
Float | |
y |
Float | |
maxWidth |
Float | (optional) |
measureText(text: String): TextMetrics
Name | Type |
---|---|
text |
String |
Returns |
---|
TextMetrics |
Name | Type |
---|---|
x |
Float |
y |
Float |
Name | Type |
---|---|
angle |
Float |
Name | Type |
---|---|
x |
Float |
y |
Float |
Name | Type |
---|---|
a |
Float |
b |
Float |
c |
Float |
d |
Float |
e |
Float |
f |
Float |
Name | Type |
---|---|
a |
Float |
b |
Float |
c |
Float |
d |
Float |
e |
Float |
f |
Float |
resetTransform(): Void
Name | Type |
---|---|
element |
Element |
Name | Type |
---|---|
element |
Element |
Returns |
---|
Bool |