coverageScale method
Smallest totalScale at which the image, rotated by rotateZ,
can still cover the whole crop rect: the crop rect's bounding
box in the image-aligned frame must fit inside the source.
Implementation
double coverageScale(double rotateZ) {
final c = dartmath.cos(rotateZ).abs();
final s = dartmath.sin(rotateZ).abs();
final w = crop.width * c + crop.height * s;
final h = crop.width * s + crop.height * c;
return dartmath.max(w / imageSize.width, h / imageSize.height);
}