Back to Content

CanvasPattern

files/en-us/web/api/canvaspattern/index.md

latest977 B
Original Source

{{APIRef("Canvas API")}}{{AvailableInWorkers}}

The CanvasPattern interface represents an opaque object describing a pattern, based on an image, a canvas, or a video, created by the {{domxref("CanvasRenderingContext2D.createPattern()")}} method.

It can be used as a {{domxref("CanvasRenderingContext2D.fillStyle", "fillStyle")}} or {{domxref("CanvasRenderingContext2D.strokeStyle", "strokeStyle")}}.

Instance properties

As an opaque object, this has no exposed property.

Instance methods

There are no inherited method.

  • {{domxref("CanvasPattern.setTransform()")}}
    • : Applies a {{domxref("DOMMatrix")}} representing a linear transform to the pattern.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{domxref("CanvasRenderingContext2D.createPattern()")}}
  • The {{HTMLElement("canvas")}} element and its associated interface, {{domxref("HTMLCanvasElement")}}