asPointTransformer method
Returns a ShapePointTransformer that applies this matrix.
This is the bridge between the transformation types Flutter already uses
and the shape transformation methods, so that a matrix built with the
usual Matrix2 helpers can be passed straight to
RoundedPolygon.transformed, Morph, PolygonFeature.transformed or
CubicBezier.transformed:
final RoundedPolygon rotated = polygon.transformed(
Matrix2.rotation(math.pi / 4).asPointTransformer(),
);
Implementation
ShapePointTransformer asPointTransformer() {
final m = storage;
final m00 = m[0];
final m10 = m[1];
final m01 = m[2];
final m11 = m[3];
return (x, y) => (m00 * x + m01 * y, m10 * x + m11 * y);
}