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 Matrix4 helpers can be passed straight to RoundedPolygon.transformed, Morph, PolygonFeature.transformed or CubicBezier.transformed:
final RoundedPolygon rotated = polygon.transformed(
Matrix4.rotationZ(math.pi / 4).asPointTransformer(),
);
Only the X and Y components of the result are used, so the Z translation and perspective rows of the matrix have no effect.
Implementation
ShapePointTransformer asPointTransformer() {
final m = storage;
final m00 = m[0];
final m10 = m[4];
final m30 = m[12];
final m01 = m[1];
final m11 = m[5];
final m31 = m[13];
return (x, y) => (m00 * x + m10 * y + m30, m01 * x + m11 * y + m31);
}