TIL about createPattern() while adding backgroundRepeat support to Pintura.
To create a pattern you can use multiple drawImage() calls, but that's very slow.
Instead use createPattern()
Set fillStyle to your pattern, call fillRect() to draw it.
developer.mozilla.org/en-US/…
ALT // Create a pattern with your image
const myPattern = ctx.createPattern(myImage, 'repeat');
// Set the pattern as fillStyle
ctx.fillStyle = myPattern;
// Fill a rectangle with your pattern
ctx.fillRect(0,0, 256, 128);