CanvasRenderingContext2D class

Inheritance
Implements
Annotations
  • @DomName('CanvasRenderingContext2D')

Static Properties

instanceRuntimeTypeType
@Deprecated("Internal Use Only"), read-only

Constructors

CanvasRenderingContext2D.internal_()

Properties

backingStorePixelRatiodouble
@deprecated, @DomName('CanvasRenderingContext2D.webkitBackingStorePixelRation'), @Experimental(), read-only

Deprecated always returns 1.0

canvasCanvasElement
@DocsEditable(), @DomName('CanvasRenderingContext2D.canvas'), @Experimental(), read-only
currentTransformMatrix
@DocsEditable(), @DomName('CanvasRenderingContext2D.currentTransform'), @Experimental(), read / write
directionString
@DocsEditable(), @DomName('CanvasRenderingContext2D.direction'), @Experimental(), read / write
fillStyleObject
@DocsEditable(), @DomName('CanvasRenderingContext2D.fillStyle'), read / write
filterString
@DocsEditable(), @DomName('CanvasRenderingContext2D.filter'), @Experimental(), read / write
fontString
@DocsEditable(), @DomName('CanvasRenderingContext2D.font'), read / write
globalAlphanum
@DocsEditable(), @DomName('CanvasRenderingContext2D.globalAlpha'), read / write
globalCompositeOperationString
@DocsEditable(), @DomName('CanvasRenderingContext2D.globalCompositeOperation'), read / write
imageSmoothingEnabledbool
@DocsEditable(), @DomName('CanvasRenderingContext2D.imageSmoothingEnabled'), @Experimental(), read / write

Whether images and patterns on this canvas will be smoothed when this canvas is scaled.

imageSmoothingQualityString
@DocsEditable(), @DomName('CanvasRenderingContext2D.imageSmoothingQuality'), @Experimental(), read / write
lineCapString
@DocsEditable(), @DomName('CanvasRenderingContext2D.lineCap'), read / write
lineDashOffsetnum
@DocsEditable(), @DomName('CanvasRenderingContext2D.lineDashOffset'), read / write
lineJoinString
@DocsEditable(), @DomName('CanvasRenderingContext2D.lineJoin'), read / write
lineWidthnum
@DocsEditable(), @DomName('CanvasRenderingContext2D.lineWidth'), read / write
miterLimitnum
@DocsEditable(), @DomName('CanvasRenderingContext2D.miterLimit'), read / write
shadowBlurnum
@DocsEditable(), @DomName('CanvasRenderingContext2D.shadowBlur'), read / write
shadowColorString
@DocsEditable(), @DomName('CanvasRenderingContext2D.shadowColor'), read / write
shadowOffsetXnum
@DocsEditable(), @DomName('CanvasRenderingContext2D.shadowOffsetX'), read / write
shadowOffsetYnum
@DocsEditable(), @DomName('CanvasRenderingContext2D.shadowOffsetY'), read / write
strokeStyleObject
@DocsEditable(), @DomName('CanvasRenderingContext2D.strokeStyle'), read / write
textAlignString
@DocsEditable(), @DomName('CanvasRenderingContext2D.textAlign'), read / write
textBaselineString
@DocsEditable(), @DomName('CanvasRenderingContext2D.textBaseline'), read / write
hashCodeint
read-only, inherited
runtimeTypeType
read-only, inherited

A representation of the runtime type of the object.

Operators

operator ==(other) → bool
inherited

The equality operator.

Methods

addHitRegion([Map options ]) → void
arc(num x, num y, num radius, num startAngle, num endAngle, [ bool anticlockwise = false ]) → void
@DomName('CanvasRenderingContext2D.arc')
arcTo(num x1, num y1, num x2, num y2, num radius) → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.arcTo')
beginPath() → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.beginPath')
bezierCurveTo(num cp1x, num cp1y, num cp2x, num cp2y, num x, num y) → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.bezierCurveTo')
clearHitRegions() → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.clearHitRegions'), @Experimental()
clearRect(num x, num y, num width, num height) → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.clearRect')
clip([path_OR_winding, String winding ]) → void
closePath() → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.closePath')
createImageData(imagedata_OR_sw, [ num sh ]) → ImageData
createImageDataFromImageData(ImageData imagedata) → ImageData
@DocsEditable(), @DomName('CanvasRenderingContext2D.createImageDataFromImageData')
createLinearGradient(num x0, num y0, num x1, num y1) → CanvasGradient
@DocsEditable(), @DomName('CanvasRenderingContext2D.createLinearGradient')
createPattern(Object image, String repetitionType) → CanvasPattern
@DocsEditable(), @DomName('CanvasRenderingContext2D.createPattern')
createPatternFromImage(ImageElement image, String repetitionType) → CanvasPattern
@DomName('CanvasRenderingContext2D.createPatternFromImage')
createRadialGradient(num x0, num y0, num r0, num x1, num y1, num r1) → CanvasGradient
@DocsEditable(), @DomName('CanvasRenderingContext2D.createRadialGradient')
drawFocusIfNeeded(element_OR_path, [ Element element ]) → void
drawImage(CanvasImageSource source, num destX, num destY) → void
@DomName('CanvasRenderingContext2D.drawImage')

Draws an image from a CanvasImageSource to this canvas.

drawImageScaled(CanvasImageSource source, num destX, num destY, num destWidth, num destHeight) → void
@DomName('CanvasRenderingContext2D.drawImage')

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
@DomName('CanvasRenderingContext2D.drawImage')

Draws an image from a CanvasImageSource to an area of this canvas.

drawImageToRect(CanvasImageSource source, Rectangle destRect, { Rectangle sourceRect }) → void
@DomName('CanvasRenderingContext2D.drawImage')

Draws an image from a CanvasImageSource to an area of this canvas.

ellipse(num x, num y, num radiusX, num radiusY, num rotation, num startAngle, num endAngle, bool anticlockwise) → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.ellipse'), @Experimental()
fill([path_OR_winding, String winding ]) → void
fillRect(num x, num y, num width, num height) → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.fillRect')
fillText(String text, num x, num y, [ num maxWidth ]) → void
getContextAttributes() → dynamic
@DocsEditable(), @DomName('CanvasRenderingContext2D.getContextAttributes'), @Experimental()
getImageData(num sx, num sy, num sw, num sh) → ImageData
@DocsEditable(), @DomName('CanvasRenderingContext2D.getImageData')
getLineDash() → List<num>
@DomName('CanvasRenderingContext2D.getLineDash'), @SupportedBrowser(SupportedBrowser.CHROME), @SupportedBrowser(SupportedBrowser.IE, '11'), @SupportedBrowser(SupportedBrowser.SAFARI), @Unstable()
isContextLost() → bool
@DocsEditable(), @DomName('CanvasRenderingContext2D.isContextLost'), @Experimental()
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
lineTo(num x, num y) → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.lineTo')
measureText(String text) → TextMetrics
@DocsEditable(), @DomName('CanvasRenderingContext2D.measureText')
moveTo(num x, num y) → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.moveTo')
putImageData(ImageData imagedata, num dx, num dy, [ num dirtyX, num dirtyY, num dirtyWidth, num dirtyHeight ]) → void
quadraticCurveTo(num cpx, num cpy, num x, num y) → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.quadraticCurveTo')
rect(num x, num y, num width, num height) → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.rect')
removeHitRegion(String id) → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.removeHitRegion'), @Experimental()
resetTransform() → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.resetTransform'), @Experimental()
restore() → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.restore')
rotate(num angle) → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.rotate')
save() → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.save')
scale(num x, num y) → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.scale')
scrollPathIntoView([Path2D path ]) → void
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.

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.

setLineDash(List<num> dash) → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.setLineDash')
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.

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.

setTransform(num a, num b, num c, num d, num e, num f) → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.setTransform')
stroke([Path2D path ]) → void
strokeRect(num x, num y, num width, num height) → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.strokeRect')
strokeText(String text, num x, num y, [ num maxWidth ]) → void
transform(num a, num b, num c, num d, num e, num f) → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.transform')
translate(num x, num y) → void
@DocsEditable(), @DomName('CanvasRenderingContext2D.translate')
noSuchMethod(Invocation invocation) → dynamic
inherited

Invoked when a non-existent method or property is accessed.

toString() → String
inherited

Returns the result of the JavaScript objects toString method.

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-html/CanvasRenderingContext2D-class.html