Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/skia_canvas/src/context2d.ts>CanvasRenderingContext2D

Fast HTML Canvas API implementation for Deno using Google Skia
Latest
class CanvasRenderingContext2D
import { CanvasRenderingContext2D } from "https://deno.land/x/skia_canvas@0.5.8/src/context2d.ts";

Constructors

new
CanvasRenderingContext2D(canvas: Canvas, ptr: Deno.PointerValue)

Properties

_unsafePointer: Deno.PointerValue
readonly
canvas: Canvas
direction: TextDirection
fillStyle: Style
filter: string
font: string
fontKerning: FontKerning
fontStretch: FontStretch
writeonly
fontVariant: FontVariantCaps
readonly
fontVariantCaps: FontVariantCaps
globalAlpha: number
globalCompositeOperation: GlobalCompositeOperation
imageSmoothingEnabled: boolean
imageSmoothingQuality: ImageSmoothingQuality
letterSpacing: string
lineCap: LineCap
lineDashOffset: number
lineJoin: LineJoin
lineWidth: number
miterLimit: number
shadowBlur: number
shadowColor: string
shadowOffsetX: number
shadowOffsetY: number
strokeStyle: Style
textAlign: TextAlign
textBaseline: TextBaseline
textRendering: TextRendering
wordSpacing: string
[_canvas]: Canvas
[_fillStyle]: Style
[_filter]: string
[_font]: string
[_fontStretch]: FontStretch
[_fontVariantCaps]: FontVariantCaps
[_lineDash]: number[]
[_shadowColor]: string
[_strokeStyle]: Style

Methods

arc(
x: number,
y: number,
radius: number,
startAngle: number,
endAngle: number,
anticlockwise: boolean,
)
arcTo(
x1: number,
y1: number,
x2: number,
y2: number,
radius: number,
)
bezierCurveTo(
cp1x: number,
cp1y: number,
cp2x: number,
cp2y: number,
x: number,
y: number,
)
clearRect(
x: number,
y: number,
width: number,
height: number,
)
clip(): void
clip(path: Path2D): void
clip(fillRule: FillRule): void
clip(path: Path2D, fillRule: FillRule): void
createConicGradient(
r: number,
x: number,
y: number,
): CanvasGradient
createImageData(sw: number, sh: number): ImageData
createLinearGradient(
x0: number,
y0: number,
x1: number,
y1: number,
): CanvasGradient
createRadialGradient(
x0: number,
y0: number,
r0: number,
x1: number,
y1: number,
r1: number,
): CanvasGradient
drawImage(
dx: number,
dy: number,
): void
drawImage(
dx: number,
dy: number,
dw: number,
dh: number,
): void
drawImage(
sx: number,
sy: number,
sw: number,
sh: number,
dx: number,
dy: number,
dw: number,
dh: number,
): void
ellipse(
x: number,
y: number,
radiusX: number,
radiusY: number,
rotation: number,
startAngle: number,
endAngle: number,
anticlockwise: boolean,
)
fill(): void
fill(path: Path2D): void
fill(rule: FillRule): void
fill(path: Path2D, rule: FillRule): void
fillRect(
x: number,
y: number,
width: number,
height: number,
)
fillText(
text: string,
x: number,
y: number,
maxWidth?: number,
)
getContextAttributes(): { alpha: boolean; desynchronized: boolean; }
getImageData(
sx: number,
sy: number,
sw: number,
sh: number,
): ImageData
getLineDash(): number[]
isContextLost(): boolean
isPointInPath(
x: number,
y: number,
fillRule?: FillRule,
): boolean
isPointInPath(
path: Path2D,
x: number,
y: number,
fillRule?: FillRule,
): boolean
isPointInStroke(x: number, y: number): boolean
isPointInStroke(
path: Path2D,
x: number,
y: number,
): boolean
lineTo(x: number, y: number)
measureText(text: string): TextMetrics
moveTo(x: number, y: number)
putImageData(
imagedata: ImageData,
dx: number,
dy: number,
dirtyX?: number,
dirtyY?: number,
dirtyWidth?: number,
dirtyHeight?: number,
)
quadraticCurveTo(
cpx: number,
cpy: number,
x: number,
y: number,
)
rect(
x: number,
y: number,
width: number,
height: number,
)
rotate(angle: number)
roundRect(
x: number,
y: number,
width: number,
height: number,
)
scale(x: number, y: number)
setLineDash(value: number[])
setTransform(
a: number,
b: number,
c: number,
d: number,
e: number,
f: number,
): void
setTransform(matrix: DOMMatrix): void
stroke(path?: Path2D)
strokeRect(
x: number,
y: number,
width: number,
height: number,
)
strokeText(
text: string,
x: number,
y: number,
maxWidth?: number,
)
transform(
a: number,
b: number,
c: number,
d: number,
e: number,
f: number,
)
translate(x: number, y: number)