copyWithProperCropShape method

CroppableImageData copyWithProperCropShape({
  1. Size? imageSize,
  2. Rect? cropRect,
  3. BaseTransformations? baseTransformations,
  4. Matrix4? imageTransform,
  5. Matrix4? currentImageTransform,
  6. required CropShapeFn cropShapeFn,
})

Copies this CroppableImageData with the given parameters and automatically sets the proper crop shape.

Implementation

CroppableImageData copyWithProperCropShape({
  Size? imageSize,
  Rect? cropRect,
  BaseTransformations? baseTransformations,
  Matrix4? imageTransform,
  Matrix4? currentImageTransform,
  required CropShapeFn cropShapeFn,
}) {
  return copyWith(
    imageSize: imageSize ?? this.imageSize,
    cropRect: cropRect ?? this.cropRect,
    imageTransform: imageTransform ?? this.imageTransform,
    currentImageTransform:
        currentImageTransform ?? this.currentImageTransform,
    baseTransformations: baseTransformations ?? this.baseTransformations,
    cropShape: cropShapeFn(
      vg.globalPathBuilder,
      (cropRect ?? this.cropRect).size,
    ),
  );
}