pattern()

Produces an SVG "pattern" element.

Syntax

pattern(
   id STRING,
   x DECIMAL,
   y DECIMAL,
   width DECIMAL,
   height DECIMAL,
   patternUnits STRING,
   patternContentUnits STRING,
   patternTransform STRING,
   preserveAspectRatio STRING )
  RETURNS om.DomNode
  1. id is the SVG object identifier.
  2. x defines the X coordinate where the patterm starts.
  3. y defines the Y coordinate where the patterm starts.
  4. width defines the width of the pattern.
  5. height defines the height of the pattern.
  6. patternUnits defines the patternUnits attribute.
  7. patternContentUnits defines the patternContentUnits attribute.
  8. patternTransform defines the patternTransform attribute.
  9. preserveAspectRatio is the aspect ratio to preserve.

Usage

This function creates a "pattern" SVG DOM element from the parameters.

The resulting DOM can be used in a "defs" element created with the defs() function, to produce pattern definitions.

Example

DEFINE pattern, n om.DomNode
...
LET pattern = fglsvgcanvas.pattern( "pattern1", 0,0,20,20, "userSpaceOnUse",
                                    NULL, "rotate(45)", NULL )
CALL pattern.appendChild( n:=fglsvgcanvas.rect(0,0,1000,10,NULL,NULL) )
CALL n.setAttribute(SVGATT_STYLE, 'stroke:none; fill:blue;' )
CALL pattern.appendChild( n:=fglsvgcanvas.rect(0,10,1000,10,NULL,NULL) )
CALL n.setAttribute(SVGATT_STYLE, 'stroke:none; fill:navy;' )