description

# CanvasRenderingContext2D class Null safety

Implemented types
  - CanvasRenderingContext
Annotations
  - @Native("CanvasRenderingContext2D")

## Properties

backingStorePixelRatio → double
  Deprecated always returns 1.0
  read-only
canvas → CanvasElement
  read-only, override
currentTransform ↔ Matrix?
  read / write
direction ↔ String?
  read / write
fillStyle ↔ Object?
  @Creates('String|CanvasGradient|CanvasPattern'), @Returns('String|CanvasGradient|CanvasPattern'), read / write
filter ↔ String?
  read / write
font ↔ String
  read / write
globalAlpha ↔ num
  read / write
globalCompositeOperation ↔ String
  read / write
hashCode → int
  The hash code for this object. [...]
  read-only, inherited
imageSmoothingEnabled ↔ bool?
  Whether images and patterns on this canvas will be smoothed when this canvas is scaled. [...]
  read / write
imageSmoothingQuality ↔ String?
  read / write
lineCap ↔ String
  read / write
lineDashOffset ↔ num
  @SupportedBrowser(SupportedBrowser.CHROME), @SupportedBrowser(SupportedBrowser.IE, '11'), @SupportedBrowser(SupportedBrowser.SAFARI), @Unstable(), read / write
lineJoin ↔ String
  read / write
lineWidth ↔ num
  read / write
miterLimit ↔ num
  read / write
runtimeType → Type
  A representation of the runtime type of the object.
  read-only, inherited
shadowBlur ↔ num
  read / write
shadowColor ↔ String
  read / write
shadowOffsetX ↔ num
  read / write
shadowOffsetY ↔ num
  read / write
strokeStyle ↔ Object?
  @Creates('String|CanvasGradient|CanvasPattern'), @Returns('String|CanvasGradient|CanvasPattern'), read / write
textAlign ↔ String
  read / write
textBaseline ↔ String
  read / write

## Methods

addHitRegion([Map? options]) → void
arc(num x, num y, num radius, num startAngle, num endAngle, [bool anticlockwise = false]) → void
arcTo(num x1, num y1, num x2, num y2, num radius) → void
beginPath() → void
bezierCurveTo(num cp1x, num cp1y, num cp2x, num cp2y, num x, num y) → void
clearHitRegions() → void
clearRect(num x, num y, num width, num height) → void
clip([dynamic path_OR_winding, String? winding]) → void
closePath() → void
createImageData(dynamic data_OR_imagedata_OR_sw, [int? sh_OR_sw, dynamic imageDataColorSettings_OR_sh, Map? imageDataColorSettings]) → ImageData
  @Creates('ImageData|=Object')
createImageDataFromImageData(ImageData imagedata) → ImageData
createLinearGradient(num x0, num y0, num x1, num y1) → CanvasGradient
createPattern(Object 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(dynamic element_OR_path, [Element? element]) → void
drawImage(CanvasImageSource source, num destX, num destY) → void
  Draws an image from a CanvasImageSource to this canvas. [...]
  @JSName('drawImage')
drawImageScaled(CanvasImageSource source, num destX, num destY, num destWidth, num destHeight) → void
  Draws an image from a CanvasImageSource to an area of this canvas. [...]
  @JSName('drawImage')
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. [...]
  @JSName('drawImage')
drawImageToRect(CanvasImageSource source, Rectangle<num> destRect, {Rectangle<num>? sourceRect}) → void
  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
fill([dynamic 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
  Draws text to the canvas. [...]
getContextAttributes() → Map
getImageData(int sx, int sy, int sw, int sh) → ImageData
  @Creates('ImageData|=Object')
getLineDash() → List<num>
  @SupportedBrowser(SupportedBrowser.CHROME), @SupportedBrowser(SupportedBrowser.IE, '11'), @SupportedBrowser(SupportedBrowser.SAFARI), @Unstable()
isContextLost() → bool
isPointInPath(dynamic path_OR_x, num x_OR_y, [dynamic winding_OR_y, String? winding]) → bool
isPointInStroke(dynamic path_OR_x, num x_OR_y, [num? y]) → bool
lineTo(num x, num y) → void
measureText(String text) → TextMetrics
moveTo(num x, num y) → void
noSuchMethod(Invocation invocation) → dynamic
  Invoked when a non-existent method or property is accessed. [...]
  inherited
putImageData(ImageData imagedata, int dx, int dy, [int? dirtyX, int? dirtyY, int? dirtyWidth, int? dirtyHeight]) → void
quadraticCurveTo(num cpx, num cpy, num x, num y) → void
rect(num x, num y, num width, num height) → 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
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
  @SupportedBrowser(SupportedBrowser.CHROME), @SupportedBrowser(SupportedBrowser.IE, '11'), @SupportedBrowser(SupportedBrowser.SAFARI), @Unstable()
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
stroke([Path2D? path]) → void
strokeRect(num x, num y, num width, num height) → void
strokeText(String text, num x, num y, [num? maxWidth]) → void
toString() → String
  Returns a string representation of this object.
  inherited
transform(num a, num b, num c, num d, num e, num f) → void
translate(num x, num y) → void

## Operators

operator ==(Object other) → bool
  The equality operator. [...]
  inherited