CanvasPattern class
An opaque object representing a pattern of image, canvas, or video.
Created by calling createPattern
on a CanvasRenderingContext2D object.
Example usage:
var canvas = new CanvasElement(width: 600, height: 600);
var ctx = canvas.context2D;
var img = new ImageElement();
// Image src needs to be loaded before pattern is applied.
img.onLoad.listen((event) {
// When the image is loaded, create a pattern
// from the ImageElement.
CanvasPattern pattern = ctx.createPattern(img, 'repeat');
ctx.rect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = pattern;
ctx.fill();
});
img.src = "images/foo.jpg";
document.body.children.add(canvas);
See also:
- CanvasPattern from MDN.
- CanvasPattern from WHATWG.
- CanvasPattern from W3C.
- Annotations
- @Native("CanvasPattern")
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
setTransform(
dynamic transform) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited