Donner
C++20 SVG rendering library
Loading...
Searching...
No Matches
"<pattern>"

Defines a paint server containing a repeated pattern, which is tiled to fill the area.

These elements are typically placed within a "<defs>" element, and then referenced by id from a fill or stroke attribute.

<pattern id="MyPattern" viewbox="0,0,10,10" width="15%" height="15%">
<circle cx="5" cy="5" r="5" fill="red" />
</pattern>

To reference it with a fill:

<rect fill="url(#MyPattern)" width="300" height="300" />

Attribute Default Description
viewBox (none) A list of four numbers (min-x, min-y, width, height) separated by whitespace and/or a comma, that specify a rectangle in userspace that should be mapped to the SVG viewport bounds established by the pattern.
preserveAspectRatio xMidYMid meet How to scale the viewport to fit the content. Only applies is viewBox is specified.
x 0 Defines the top-left X coordinate of a rectangle indicating how pattern tiles are placed and spread. The coordinate system is determined by the combination of the patternUnits and patternTransform attributes.
y 0 Defines the top-left Y coordinate of a rectangle indicating how pattern tiles are placed and spread. The coordinate system is determined by the combination of the patternUnits and patternTransform attributes.
width 0 Defines the width of a rectangle indicating how pattern tiles are placed and spread. The coordinate system is determined by the combination of the patternUnits and patternTransform attributes.
height 0 Defines the height of a rectangle indicating how pattern tiles are placed and spread. The coordinate system is determined by the combination of the patternUnits and patternTransform attributes.
patternUnits objectBoundingBox Defines the coordinate system for attributes x, y, width, and height.
patternContentUnits userSpaceOnUse Defines the coordinate system for the contents of the pattern. Note that this attribute has no effect if the viewBox attribute is specified.
patternTransform identity Optional transformation from the pattern coordinate system onto the target coordinate system, allowing things like skewing the pattern tiles.
href (none) Reference to another pattern element to use as a template.