scaleStrokeWidth method

double? scaleStrokeWidth(
  1. double? width
)

Calculates the scale for a stroke width based on the average of the x- and y-axis scales of this matrix.

Implementation

double? scaleStrokeWidth(double? width) {
  if (width == null || (a == 1 && d == 1)) {
    return width;
  }

  final double xScale = math.sqrt(a * a + c * c);
  final double yScale = math.sqrt(b * b + d * d);

  return (xScale + yScale) / 2 * width;
}