Dart SDK
dart:html
CanvasRenderingContext2D
class
CanvasRenderingContext2D
Properties
Methods
Properties
canvas
currentTransform
direction
fillStyle
font
globalAlpha
globalCompositeOperation
imageSmoothingEnabled
lineCap
lineDashOffset
lineJoin
lineWidth
miterLimit
shadowBlur
shadowColor
shadowOffsetX
shadowOffsetY
strokeStyle
textAlign
textBaseline
backingStorePixelRatio
Methods
addHitRegion
beginPath
clearHitRegions
clearRect
clip
createImageData
createImageDataFromImageData
createLinearGradient
createPattern
createPatternFromImage
createRadialGradient
drawFocusIfNeeded
fill
fillRect
fillText
getContextAttributes
getImageData
isContextLost
isPointInPath
isPointInStroke
measureText
putImageData
removeHitRegion
resetTransform
restore
rotate
save
scale
scrollPathIntoView
setLineDash
setTransform
stroke
strokeRect
strokeText
transform
translate
arcTo
bezierCurveTo
closePath
ellipse
lineTo
moveTo
quadraticCurveTo
rect
setFillColorRgb
setFillColorHsl
setStrokeColorRgb
setStrokeColorHsl
arc
drawImageToRect
drawImage
drawImageScaled
drawImageScaledFromSource
getLineDash
(Not documented.)
Annotations
DomName('CanvasRenderingContext2D')
Implements
CanvasRenderingContext
Properties
CanvasElement
canvas
read-only
Matrix
currentTransform
read / write
String
direction
read / write
Object
fillStyle
read / write
String
font
read / write
num
globalAlpha
read / write
String
globalCompositeOperation
read / write
bool
imageSmoothingEnabled
read / write
Whether images and patterns on this canvas will be smoothed when this canvas is scaled.
String
lineCap
read / write
num
lineDashOffset
read / write
String
lineJoin
read / write
num
lineWidth
read / write
num
miterLimit
read / write
num
shadowBlur
read / write
String
shadowColor
read / write
num
shadowOffsetX
read / write
num
shadowOffsetY
read / write
Object
strokeStyle
read / write
String
textAlign
read / write
String
textBaseline
read / write
double
backingStorePixelRatio
read-only
Deprecated always returns 1.0
Methods
addHitRegion
(
[
Map
options
]) →
void
beginPath
(
) →
void
clearHitRegions
(
) →
void
clearRect
(
num
x
,
num
y
,
num
width
,
num
height
) →
void
clip
(
[
path_OR_winding
,
String
winding
]) →
void
createImageData
(
num
sw
,
num
sh
) →
ImageData
createImageDataFromImageData
(
ImageData
imagedata
) →
ImageData
createLinearGradient
(
num
x0
,
num
y0
,
num
x1
,
num
y1
) →
CanvasGradient
createPattern
(
canvas_OR_image
,
String
repetitionType
) →
CanvasPattern
createPatternFromImage
(
ImageElement
image
,
String
repetitionType
) →
CanvasPattern
createRadialGradient
(
num
x0
,
num
y0
,
num
r0
,
num
x1
,
num
y1
,
num
r1
) →
CanvasGradient
drawFocusIfNeeded
(
element_OR_path
, [
Element
element
]) →
void
fill
(
[
path_OR_winding
,
String
winding
]) →
void
fillRect
(
num
x
,
num
y
,
num
width
,
num
height
) →
void
fillText
(
String
text
,
num
x
,
num
y
, [
num
maxWidth
]) →
void
getContextAttributes
(
) →
Canvas2DContextAttributes
getImageData
(
num
sx
,
num
sy
,
num
sw
,
num
sh
) →
ImageData
isContextLost
(
) →
bool
isPointInPath
(
path_OR_x
,
num
x_OR_y
, [
winding_OR_y
,
String
winding
]) →
bool
isPointInStroke
(
path_OR_x
,
num
x_OR_y
, [
num
y
]) →
bool
measureText
(
String
text
) →
TextMetrics
putImageData
(
ImageData
imagedata
,
num
dx
,
num
dy
, [
num
dirtyX
,
num
dirtyY
,
num
dirtyWidth
,
num
dirtyHeight
]) →
void
removeHitRegion
(
String
id
) →
void
resetTransform
(
) →
void
restore
(
) →
void
rotate
(
num
angle
) →
void
save
(
) →
void
scale
(
num
x
,
num
y
) →
void
scrollPathIntoView
(
[
Path2D
path
]) →
void
setLineDash
(
List
<
num
>
dash
) →
void
setTransform
(
num
a
,
num
b
,
num
c
,
num
d
,
num
e
,
num
f
) →
void
stroke
(
[
Path2D
path
]) →
void
strokeRect
(
num
x
,
num
y
,
num
width
,
num
height
) →
void
strokeText
(
String
text
,
num
x
,
num
y
, [
num
maxWidth
]) →
void
transform
(
num
a
,
num
b
,
num
c
,
num
d
,
num
e
,
num
f
) →
void
translate
(
num
x
,
num
y
) →
void
arcTo
(
num
x1
,
num
y1
,
num
x2
,
num
y2
,
num
radius
) →
void
bezierCurveTo
(
num
cp1x
,
num
cp1y
,
num
cp2x
,
num
cp2y
,
num
x
,
num
y
) →
void
closePath
(
) →
void
ellipse
(
num
x
,
num
y
,
num
radiusX
,
num
radiusY
,
num
rotation
,
num
startAngle
,
num
endAngle
,
bool
anticlockwise
) →
void
lineTo
(
num
x
,
num
y
) →
void
moveTo
(
num
x
,
num
y
) →
void
quadraticCurveTo
(
num
cpx
,
num
cpy
,
num
x
,
num
y
) →
void
rect
(
num
x
,
num
y
,
num
width
,
num
height
) →
void
setFillColorRgb
(
int
r
,
int
g
,
int
b
, [
num
a
=
1
]) →
void
Sets the color used inside shapes. r, g, b are 0-255, a is 0-1.
setFillColorHsl
(
int
h
,
num
s
,
num
l
, [
num
a
=
1
]) →
void
Sets the color used inside shapes. h is in degrees, 0-360. s, l are in percent, 0-100. a is 0-1.
setStrokeColorRgb
(
int
r
,
int
g
,
int
b
, [
num
a
=
1
]) →
void
Sets the color used for stroking shapes. r, g, b are 0-255, a is 0-1.
setStrokeColorHsl
(
int
h
,
num
s
,
num
l
, [
num
a
=
1
]) →
void
Sets the color used for stroking shapes. h is in degrees, 0-360. s, l are in percent, 0-100. a is 0-1.
arc
(
num
x
,
num
y
,
num
radius
,
num
startAngle
,
num
endAngle
, [
bool
anticlockwise
=
false
]) →
void
drawImageToRect
(
CanvasImageSource
source
,
Rectangle
destRect
, {
Rectangle
sourceRect
}) →
void
Draws an image from a CanvasImageSource to an area of this canvas.
drawImage
(
CanvasImageSource
source
,
num
destX
,
num
destY
) →
void
Draws an image from a CanvasImageSource to this canvas.
drawImageScaled
(
CanvasImageSource
source
,
num
destX
,
num
destY
,
num
destWidth
,
num
destHeight
) →
void
Draws an image from a CanvasImageSource to an area of this canvas.
drawImageScaledFromSource
(
CanvasImageSource
source
,
num
sourceX
,
num
sourceY
,
num
sourceWidth
,
num
sourceHeight
,
num
destX
,
num
destY
,
num
destWidth
,
num
destHeight
) →
void
Draws an image from a CanvasImageSource to an area of this canvas.
getLineDash
(
) →
List
<
num
>