meo-skia-canvas
    Preparing search index...

    Interface CanvasDrawImage

    Drawing one image, canvas or pixel buffer into another.

    interface CanvasDrawImage {
        drawCanvas(image: Canvas, dx: number, dy: number): void;
        drawCanvas(
            image: Canvas,
            dx: number,
            dy: number,
            dw: number,
            dh: number,
        ): void;
        drawCanvas(
            image: Canvas,
            sx: number,
            sy: number,
            sw: number,
            sh: number,
            dx: number,
            dy: number,
            dw: number,
            dh: number,
        ): void;
        drawImage(image: CanvasDrawable, dx: number, dy: number): void;
        drawImage(
            image: CanvasDrawable,
            dx: number,
            dy: number,
            dw: number,
            dh: number,
        ): void;
        drawImage(
            image: CanvasDrawable,
            sx: number,
            sy: number,
            sw: number,
            sh: number,
            dx: number,
            dy: number,
            dw: number,
            dh: number,
        ): void;
    }

    Hierarchy (View Summary)

    Index
    • Draw another canvas, replaying its contents as vectors.

      Unlike CanvasRenderingContext2D.drawImage, which rasterizes the source first, this keeps text as text and paths as paths -- so an SVG or PDF export of the result stays selectable and scalable.

      The replay is clipped to the destination rectangle, so anything that spreads -- an imageFilter blur, a shadow -- stops at its edge instead of bleeding past it the way it does through drawImage. Give the destination room if you want the spread. This is inherited behaviour rather than a rule the Canvas standard sets: drawCanvas has no standard counterpart, and drawImage does let a filter spread.

      🧪 Not in the HTML Canvas standard.

      Parameters

      • image: Canvas
      • dx: number
      • dy: number

      Returns void

    • As above, scaled to fill the dw by dh rectangle at (dx, dy), and clipped to it.

      🧪 Not in the HTML Canvas standard.

      Parameters

      • image: Canvas
      • dx: number
      • dy: number
      • dw: number
      • dh: number

      Returns void

    • As above, replaying only the sw by sh region of image at (sx, sy) into the destination rectangle.

      🧪 Not in the HTML Canvas standard.

      Parameters

      • image: Canvas
      • sx: number
      • sy: number
      • sw: number
      • sh: number
      • dx: number
      • dy: number
      • dw: number
      • dh: number

      Returns void

    • Draws image at its natural size, with its top-left corner at (dx, dy).

      MDN Reference

      Parameters

      Returns void

    • Draws image scaled to fill the dw by dh rectangle at (dx, dy).

      MDN Reference

      Parameters

      Returns void

    • Draws the sw by sh region of image at (sx, sy), scaled to fill the dw by dh rectangle at (dx, dy).

      MDN Reference

      Parameters

      • image: CanvasDrawable
      • sx: number
      • sy: number
      • sw: number
      • sh: number
      • dx: number
      • dy: number
      • dw: number
      • dh: number

      Returns void