Interface ICanvasRenderingContext2D

Common interface for CanvasRenderingContext2D, OffscreenCanvasRenderingContext2D, and other custom canvas 2D context.

Memberof

PIXI

interface ICanvasRenderingContext2D {
    direction: CanvasDirection;
    fillStyle: string | CanvasPattern | CanvasGradient;
    filter: string;
    font: string;
    fontKerning: CanvasFontKerning;
    globalAlpha: number;
    globalCompositeOperation: GlobalCompositeOperation;
    imageSmoothingEnabled: boolean;
    imageSmoothingQuality: ImageSmoothingQuality;
    letterSpacing?: string;
    lineCap: CanvasLineCap;
    lineDashOffset: number;
    lineJoin: CanvasLineJoin;
    lineWidth: number;
    miterLimit: number;
    shadowBlur: number;
    shadowColor: string;
    shadowOffsetX: number;
    shadowOffsetY: number;
    strokeStyle: string | CanvasPattern | CanvasGradient;
    textAlign: CanvasTextAlign;
    textBaseline: CanvasTextBaseline;
    textLetterSpacing?: string;
    arc(x, y, radius, startAngle, endAngle, counterclockwise?): void;
    arc(x, y, radius, startAngle, endAngle, counterclockwise?): void;
    arcTo(x1, y1, x2, y2, radius): void;
    arcTo(x1, y1, x2, y2, radius): void;
    beginPath(): void;
    beginPath(): void;
    bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y): void;
    bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y): void;
    clearRect(x, y, w, h): void;
    clearRect(x, y, w, h): void;
    clip(fillRule?): void;
    clip(path, fillRule?): void;
    clip(fillRule?): void;
    clip(path, fillRule?): void;
    closePath(): void;
    closePath(): void;
    createConicGradient(startAngle, x, y): CanvasGradient;
    createConicGradient(startAngle, x, y): CanvasGradient;
    createImageData(sw, sh, settings?): ImageData;
    createImageData(imagedata): ImageData;
    createImageData(sw, sh, settings?): ImageData;
    createImageData(imagedata): ImageData;
    createLinearGradient(x0, y0, x1, y1): CanvasGradient;
    createLinearGradient(x0, y0, x1, y1): CanvasGradient;
    createPattern(image, repetition): null | CanvasPattern;
    createRadialGradient(x0, y0, r0, x1, y1, r1): CanvasGradient;
    createRadialGradient(x0, y0, r0, x1, y1, r1): CanvasGradient;
    drawImage(image, dx, dy): void;
    drawImage(image, dx, dy, dw, dh): void;
    drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh): void;
    ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise?): void;
    ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise?): void;
    fill(fillRule?): void;
    fill(path, fillRule?): void;
    fill(fillRule?): void;
    fill(path, fillRule?): void;
    fillRect(x, y, w, h): void;
    fillRect(x, y, w, h): void;
    fillText(text, x, y, maxWidth?): void;
    fillText(text, x, y, maxWidth?): void;
    getImageData(sx, sy, sw, sh, settings?): ImageData;
    getImageData(sx, sy, sw, sh, settings?): ImageData;
    getLineDash(): number[];
    getLineDash(): number[];
    getTransform(): DOMMatrix;
    getTransform(): DOMMatrix;
    isPointInPath(x, y, fillRule?): boolean;
    isPointInPath(path, x, y, fillRule?): boolean;
    isPointInPath(x, y, fillRule?): boolean;
    isPointInPath(path, x, y, fillRule?): boolean;
    isPointInStroke(x, y): boolean;
    isPointInStroke(path, x, y): boolean;
    isPointInStroke(x, y): boolean;
    isPointInStroke(path, x, y): boolean;
    lineTo(x, y): void;
    lineTo(x, y): void;
    measureText(text): TextMetrics;
    measureText(text): TextMetrics;
    moveTo(x, y): void;
    moveTo(x, y): void;
    putImageData(imagedata, dx, dy): void;
    putImageData(imagedata, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight): void;
    putImageData(imagedata, dx, dy): void;
    putImageData(imagedata, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight): void;
    quadraticCurveTo(cpx, cpy, x, y): void;
    quadraticCurveTo(cpx, cpy, x, y): void;
    rect(x, y, w, h): void;
    rect(x, y, w, h): void;
    reset(): void;
    reset(): void;
    resetTransform(): void;
    resetTransform(): void;
    restore(): void;
    restore(): void;
    rotate(angle): void;
    rotate(angle): void;
    roundRect(x, y, w, h, radii?): void;
    roundRect(x, y, w, h, radii?): void;
    save(): void;
    save(): void;
    scale(x, y): void;
    scale(x, y): void;
    setLineDash(segments): void;
    setLineDash(segments): void;
    setTransform(a, b, c, d, e, f): void;
    setTransform(transform?): void;
    setTransform(a, b, c, d, e, f): void;
    setTransform(transform?): void;
    stroke(): void;
    stroke(path): void;
    stroke(): void;
    stroke(path): void;
    strokeRect(x, y, w, h): void;
    strokeRect(x, y, w, h): void;
    strokeText(text, x, y, maxWidth?): void;
    strokeText(text, x, y, maxWidth?): void;
    transform(a, b, c, d, e, f): void;
    transform(a, b, c, d, e, f): void;
    translate(x, y): void;
    translate(x, y): void;
}

Hierarchy

  • CanvasState
  • CanvasTransform
  • CanvasCompositing
  • CanvasImageSmoothing
  • CanvasFillStrokeStyles
  • CanvasShadowStyles
  • CanvasFilters
  • CanvasRect
  • CanvasDrawPath
  • CanvasText
  • CanvasDrawImage
  • CanvasImageData
  • CanvasPathDrawingStyles
  • CanvasTextDrawingStyles
  • CanvasPath
    • ICanvasRenderingContext2D

Properties

direction: CanvasDirection
fillStyle: string | CanvasPattern | CanvasGradient
filter: string
font: string
fontKerning: CanvasFontKerning
globalAlpha: number
globalCompositeOperation: GlobalCompositeOperation
imageSmoothingEnabled: boolean
imageSmoothingQuality: ImageSmoothingQuality
letterSpacing?: string
lineCap: CanvasLineCap
lineDashOffset: number
lineJoin: CanvasLineJoin
lineWidth: number
miterLimit: number
shadowBlur: number
shadowColor: string
shadowOffsetX: number
shadowOffsetY: number
strokeStyle: string | CanvasPattern | CanvasGradient
textAlign: CanvasTextAlign
textBaseline: CanvasTextBaseline
textLetterSpacing?: string

Methods

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Returns void

  • Returns void

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

    • Optional fillRule: CanvasFillRule

    Returns void

  • Parameters

    • path: Path2D
    • Optional fillRule: CanvasFillRule

    Returns void

  • Parameters

    • Optional fillRule: CanvasFillRule

    Returns void

  • Parameters

    • path: Path2D
    • Optional fillRule: CanvasFillRule

    Returns void

  • Returns void

  • Returns void

  • Parameters

    • startAngle: number
    • x: number
    • y: number

    Returns CanvasGradient

  • Parameters

    • startAngle: number
    • x: number
    • y: number

    Returns CanvasGradient

  • Parameters

    • sw: number
    • sh: number
    • Optional settings: ImageDataSettings

    Returns ImageData

  • Parameters

    • imagedata: ImageData

    Returns ImageData

  • Parameters

    • sw: number
    • sh: number
    • Optional settings: ImageDataSettings

    Returns ImageData

  • Parameters

    • imagedata: ImageData

    Returns ImageData

  • Parameters

    • x0: number
    • y0: number
    • x1: number
    • y1: number

    Returns CanvasGradient

  • Parameters

    • x0: number
    • y0: number
    • x1: number
    • y1: number

    Returns CanvasGradient

  • Parameters

    • image: ICanvas | CanvasImageSource
    • repetition: null | string

    Returns null | CanvasPattern

  • Parameters

    • x0: number
    • y0: number
    • r0: number
    • x1: number
    • y1: number
    • r1: number

    Returns CanvasGradient

  • Parameters

    • x0: number
    • y0: number
    • r0: number
    • x1: number
    • y1: number
    • r1: number

    Returns CanvasGradient

  • Parameters

    • image: ICanvas | CanvasImageSource
    • dx: number
    • dy: number

    Returns void

  • Parameters

    • image: ICanvas | CanvasImageSource
    • dx: number
    • dy: number
    • dw: number
    • dh: number

    Returns void

  • Parameters

    • image: ICanvas | CanvasImageSource
    • sx: number
    • sy: number
    • sw: number
    • sh: number
    • dx: number
    • dy: number
    • dw: number
    • dh: number

    Returns void

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

    • Optional fillRule: CanvasFillRule

    Returns void

  • Parameters

    • path: Path2D
    • Optional fillRule: CanvasFillRule

    Returns void

  • Parameters

    • Optional fillRule: CanvasFillRule

    Returns void

  • Parameters

    • path: Path2D
    • Optional fillRule: CanvasFillRule

    Returns void

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

    • sx: number
    • sy: number
    • sw: number
    • sh: number
    • Optional settings: ImageDataSettings

    Returns ImageData

  • Parameters

    • sx: number
    • sy: number
    • sw: number
    • sh: number
    • Optional settings: ImageDataSettings

    Returns ImageData

  • Returns number[]

  • Returns number[]

  • Returns DOMMatrix

  • Returns DOMMatrix

  • Parameters

    • x: number
    • y: number
    • Optional fillRule: CanvasFillRule

    Returns boolean

  • Parameters

    • path: Path2D
    • x: number
    • y: number
    • Optional fillRule: CanvasFillRule

    Returns boolean

  • Parameters

    • x: number
    • y: number
    • Optional fillRule: CanvasFillRule

    Returns boolean

  • Parameters

    • path: Path2D
    • x: number
    • y: number
    • Optional fillRule: CanvasFillRule

    Returns boolean

  • Parameters

    • x: number
    • y: number

    Returns boolean

  • Parameters

    • path: Path2D
    • x: number
    • y: number

    Returns boolean

  • Parameters

    • x: number
    • y: number

    Returns boolean

  • Parameters

    • path: Path2D
    • x: number
    • y: number

    Returns boolean

  • Parameters

    • x: number
    • y: number

    Returns void

  • Parameters

    • x: number
    • y: number

    Returns void

  • Parameters

    • text: string

    Returns TextMetrics

  • Parameters

    • text: string

    Returns TextMetrics

  • Parameters

    • x: number
    • y: number

    Returns void

  • Parameters

    • x: number
    • y: number

    Returns void

  • Parameters

    • imagedata: ImageData
    • dx: number
    • dy: number

    Returns void

  • Parameters

    • imagedata: ImageData
    • dx: number
    • dy: number
    • dirtyX: number
    • dirtyY: number
    • dirtyWidth: number
    • dirtyHeight: number

    Returns void

  • Parameters

    • imagedata: ImageData
    • dx: number
    • dy: number

    Returns void

  • Parameters

    • imagedata: ImageData
    • dx: number
    • dy: number
    • dirtyX: number
    • dirtyY: number
    • dirtyWidth: number
    • dirtyHeight: number

    Returns void

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Returns void

  • Returns void

  • Returns void

  • Returns void

  • Returns void

  • Returns void

  • Parameters

    • angle: number

    Returns void

  • Parameters

    • angle: number

    Returns void

  • Parameters

    • x: number
    • y: number
    • w: number
    • h: number
    • Optional radii: number | DOMPointInit | (number | DOMPointInit)[]

    Returns void

  • Parameters

    • x: number
    • y: number
    • w: number
    • h: number
    • Optional radii: number | DOMPointInit | (number | DOMPointInit)[]

    Returns void

  • Returns void

  • Returns void

  • Parameters

    • x: number
    • y: number

    Returns void

  • Parameters

    • x: number
    • y: number

    Returns void

  • Parameters

    • segments: number[]

    Returns void

  • Parameters

    • segments: number[]

    Returns void

  • Parameters

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

    Returns void

  • Parameters

    • Optional transform: DOMMatrix2DInit

    Returns void

  • Parameters

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

    Returns void

  • Parameters

    • Optional transform: DOMMatrix2DInit

    Returns void

  • Returns void

  • Parameters

    • path: Path2D

    Returns void

  • Returns void

  • Parameters

    • path: Path2D

    Returns void

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

    • x: number
    • y: number

    Returns void

  • Parameters

    • x: number
    • y: number

    Returns void

Generated using TypeDoc