centeredScanWindow static method
Normalized scan window for a centered rectangle of size inside bounds.
Implementation
static Rect centeredScanWindow(Size bounds, Size size) {
if (bounds.width <= 0 || bounds.height <= 0) return const Rect.fromLTWH(0, 0, 1, 1);
final double width = (size.width / bounds.width).clamp(0.05, 1.0);
final double height = (size.height / bounds.height).clamp(0.05, 1.0);
return Rect.fromLTWH((1 - width) / 2, (1 - height) / 2, width, height);
}