Axis-aligned maps (no rotation/shear, i.e. m[1] === 0 && m[2] === 0) keep a
RectPath a rect — the four corners stay axis-aligned, so we transform the
two diagonal corners and normalize negative extent (mirror). Rotation or
shear promotes the rect's four corners to a PolygonPath. Polygon paths map
every coord via the kernel's transformCoords, preserving the command stream
and fillRule. Never mutates the input.
Mat3 here is the 6-tuple number[] from @weasel-js/geom (DOMMatrix order:
[a, b, c, d, e, f] where x' = a·x + c·y + e, y' = b·x + d·y + f),
not the renderer's 9-element Float32Array.
Apply an affine
Mat3to a path's geometry.Axis-aligned maps (no rotation/shear, i.e.
m[1] === 0 && m[2] === 0) keep aRectPatha rect — the four corners stay axis-aligned, so we transform the two diagonal corners and normalize negative extent (mirror). Rotation or shear promotes the rect's four corners to aPolygonPath. Polygon paths map every coord via the kernel'stransformCoords, preserving the command stream andfillRule. Never mutates the input.Mat3here is the 6-tuplenumber[]from@weasel-js/geom(DOMMatrix order:[a, b, c, d, e, f]wherex' = a·x + c·y + e,y' = b·x + d·y + f), not the renderer's 9-elementFloat32Array.