Documentation / @ripl/canvas / toCanvasPattern
Function: toCanvasPattern() ​
toCanvasPattern(
ctx,value):CanvasPattern|null
Defined in: canvas/src/utilities.ts:180
Materializes a pattern(...) paint string as a repeating CanvasPattern, drawing the shared tile geometry into an offscreen canvas. Results (including parse failures) are cached per context and string, and released by releaseCanvasPaintCache.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
ctx | CanvasRenderingContext2D | The context the pattern will paint into. |
value | string | The pattern(...) paint string. |
Returns ​
CanvasPattern | null
The repeating pattern, or null when the string or environment can't produce one.