Section 25.20. CanvasRenderingContext2D.createPattern( ): create a pattern of tiled images


25.20. CanvasRenderingContext2D.createPattern( ): create a pattern of tiled images

25.20.1. Synopsis

 CanvasPattern createPattern(Image image,                             String repetitionStyle) 

25.20.1.1. 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

"repeat"

Tile the image in both directions. This is the default.

"repeat-x"

Tile the image in the X dimension only.

"repeat-y"

Tile the image in the Y dimension only.

"no-repeat"

Do not tile the image; use it a single time only.


25.20.1.2. Returns

A CanvasPattern object representing the pattern.

25.20.2. 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.

25.20.3. Bugs

Firefox 1.5 supports only the "repeat" style. Others are ignored.

25.20.4. See Also

CanvasPattern




JavaScript. The Definitive Guide
JavaScript: The Definitive Guide
ISBN: 0596101996
EAN: 2147483647
Year: 2004
Pages: 767

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net