matrixFor method

Matrix4 matrixFor(
  1. Rect rect
)

The whole deformation as one matrix for geometry laid out in rect (used by path clippers).

Implementation

Matrix4 matrixFor(Rect rect) {
  final center = rect.center;
  return Matrix4.identity()
    ..translateByDouble(
      center.dx + offsetX * rect.width,
      center.dy,
      0.0,
      1.0,
    )
    ..multiply(matrix)
    ..translateByDouble(-center.dx, -center.dy, 0.0, 1.0);
}