Options
All
  • Public
  • Public/Protected
  • All
Menu

The CanvasRenderingContext2D interface, part of the Canvas API, provides the 2D rendering context for the drawing surface of a element. It is used for drawing shapes, text, images, and other objects.

Hierarchy

Index

Properties

direction: CanvasDirection
filter: string
font: string
fontKerning: CanvasFontKerning
globalAlpha: number
globalCompositeOperation: GlobalCompositeOperation
imageSmoothingEnabled: boolean
imageSmoothingQuality: ImageSmoothingQuality
lineCap: CanvasLineCap
lineDashOffset: number
lineJoin: CanvasLineJoin
lineWidth: number
miterLimit: number
shadowBlur: number
shadowColor: string
shadowOffsetX: number
shadowOffsetY: number
textAlign: CanvasTextAlign
textBaseline: CanvasTextBaseline

Methods

  • arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void
  • Parameters

    • x: number
    • y: number
    • radius: number
    • startAngle: number
    • endAngle: number
    • Optional counterclockwise: boolean

    Returns void

  • arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void
  • Parameters

    • x1: number
    • y1: number
    • x2: number
    • y2: number
    • radius: number

    Returns void

  • beginPath(): void
  • bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void
  • Parameters

    • cp1x: number
    • cp1y: number
    • cp2x: number
    • cp2y: number
    • x: number
    • y: number

    Returns void

  • clearRect(x: number, y: number, w: number, h: number): void
  • Parameters

    • x: number
    • y: number
    • w: number
    • h: number

    Returns void

  • closePath(): void
  • Returns void

  • createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): internal.CanvasGradient
  • drawImage(image: CanvasImageSource, dx: number, dy: number): void
  • drawImage(image: CanvasImageSource, dx: number, dy: number, dw: number, dh: number): void
  • drawImage(image: CanvasImageSource, 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, counterclockwise?: boolean): void
  • Parameters

    • x: number
    • y: number
    • radiusX: number
    • radiusY: number
    • rotation: number
    • startAngle: number
    • endAngle: number
    • Optional counterclockwise: boolean

    Returns void

  • fillRect(x: number, y: number, w: number, h: number): void
  • Parameters

    • x: number
    • y: number
    • w: number
    • h: number

    Returns void

  • fillText(text: string, x: number, y: number, maxWidth?: number): void
  • Parameters

    • text: string
    • x: number
    • y: number
    • Optional maxWidth: number

    Returns void

  • getLineDash(): number[]
  • isPointInStroke(x: number, y: number): boolean
  • isPointInStroke(path: internal.Path2D, x: number, y: number): boolean
  • lineTo(x: number, y: number): void
  • Parameters

    • x: number
    • y: number

    Returns void

  • moveTo(x: number, y: number): void
  • Parameters

    • x: number
    • y: number

    Returns void

  • putImageData(imagedata: internal.ImageData, dx: number, dy: number): void
  • putImageData(imagedata: internal.ImageData, dx: number, dy: number, dirtyX: number, dirtyY: number, dirtyWidth: number, dirtyHeight: number): void
  • quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void
  • Parameters

    • cpx: number
    • cpy: number
    • x: number
    • y: number

    Returns void

  • rect(x: number, y: number, w: number, h: number): void
  • Parameters

    • x: number
    • y: number
    • w: number
    • h: number

    Returns void

  • resetTransform(): void
  • restore(): void
  • Returns void

  • rotate(angle: number): void
  • Parameters

    • angle: number

    Returns void

  • save(): void
  • Returns void

  • scale(x: number, y: number): void
  • Parameters

    • x: number
    • y: number

    Returns void

  • setLineDash(segments: number[]): void
  • setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void
  • setTransform(transform?: DOMMatrix2DInit): void
  • strokeRect(x: number, y: number, w: number, h: number): void
  • Parameters

    • x: number
    • y: number
    • w: number
    • h: number

    Returns void

  • strokeText(text: string, x: number, y: number, maxWidth?: number): void
  • Parameters

    • text: string
    • x: number
    • y: number
    • Optional maxWidth: number

    Returns void

  • transform(a: number, b: number, c: number, d: number, e: number, f: number): void
  • Parameters

    • a: number
    • b: number
    • c: number
    • d: number
    • e: number
    • f: number

    Returns void

  • translate(x: number, y: number): void
  • Parameters

    • x: number
    • y: number

    Returns void

Generated using TypeDoc