calculateRotatedBounds static method

Size calculateRotatedBounds({
  1. required Image image,
  2. required double angle,
})

计算旋转后图片的边界框尺寸

Implementation

static Size calculateRotatedBounds({
  required ui.Image image,
  required double angle,
}) {
  final sinAngle = math.sin(angle).abs();
  final cosAngle = math.cos(angle).abs();
  final width = image.width * cosAngle + image.height * sinAngle;
  final height = image.width * sinAngle + image.height * cosAngle;
  return Size(width, height);
}