Name
CanvasRenderingContext2D.createPattern( ): create a pattern of tiled images
Synopsis
CanvasPattern createPattern(Imageimage
, StringrepetitionStyle
)
Arguments
-
image
The image to be tiled. This argument is typically an Image object, but you may also use a Canvas element.
-
repetitionStyle
Specifies how the image is tiled. The possible values are the following:
Value |
Meaning |
|
Tile the image in both directions. This is the default. |
|
Tile the image in the X dimension only. |
|
Tile the image in the Y dimension only. |
|
Do not tile the image; use it a single time only. |
Returns
A CanvasPattern object representing the pattern.
Description
This method creates and returns a CanvasPattern object that
represents the pattern defined by a tiled image. To use a pattern
for stroking lines or filling areas, use a CanvasPattern object as
the value of the strokeStyle
or
fillStyle
properties.
Bugs
Firefox 1.5 supports only the "repeat"
style. Others are ignored.
See Also
CanvasPattern
Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.