createPattern method

CanvasPattern? createPattern(
  1. CanvasImageSource image,
  2. String repetition
)

The CanvasRenderingContext2D.createPattern() method of the Canvas 2D API creates a pattern using the specified image and repetition. This method returns a CanvasPattern.

This method doesn't draw anything to the canvas directly. The pattern it creates must be assigned to the CanvasRenderingContext2D.fillStyle or CanvasRenderingContext2D.strokeStyle properties, after which it is applied to any subsequent drawing.

Implementation

external CanvasPattern? createPattern(
  CanvasImageSource image,
  String repetition,
);