OptionalcolorColor space the pixels are converted to on the way out, defaulting to the canvas's own.
A browser makes the same distinction: getImageData() on a
display-p3 canvas hands back P3 components, and the ImageData
returned reports the space through its own colorSpace. The same red
reads as 255,0,0 in sRGB and 234,51,35 in display-p3.
OptionalcolorPixel format the export is handed back in, defaulting to the canvas's own.
This is what makes toBuffer("raw", {colorType: "RGBAF32"}) differ from
the canvas it came from. Compositing still follows the canvas: a
readback format has no business choosing the precision a page is drawn
at.
OptionaldensityNumber of pixels per grid ‘point’ (defaults to 1)
OptionalmatteBackground color to draw beneath transparent parts of the canvas
OptionalmsaaNumber of samples used for antialiasing each pixel. 0 and 1 both
mean one sample a pixel -- no multisampling.
How to rasterize a canvas region when reading its pixels out.