On this page
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.
- Inheritance
-
- Object
- JSObject
- DartHtmlDomObject
- CanvasPattern
- Annotations
-
- @DocsEditable()
- @DomName('CanvasPattern')
Static Properties
- instanceRuntimeType → Type
@Deprecated("Internal Use Only"), read-only
Constructors
Properties
- hashCode → int
read-only, inherited
- runtimeType → Type
read-only, inherited
-
A representation of the runtime type of the object.
Operators
- operator ==(
other) → bool inherited -
The equality operator.
Methods
- setTransform(
Matrix transform) → void @DocsEditable(), @DomName('CanvasPattern.setTransform'), @Experimental() - noSuchMethod(
Invocation invocation) → dynamic inherited -
Invoked when a non-existent method or property is accessed.
- toString(
) → String inherited -
Returns the result of the JavaScript objects
toString
method.
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-html/CanvasPattern-class.html