diff --git a/CHANGELOG.md b/CHANGELOG.md index aa2ac389..bcacd097 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## 12.0.3 +- **FEAT**(crop-rotate-editor): Add `exportOvalMask` to `CropRotateEditorConfigs` (default `true`). When set to `false`, the exported image uses a plain rectangular crop even if `CropMode.oval` is active, while the oval UI remains visible inside the crop editor. - **FEAT**(crop-rotate-editor): Add `helperLineWidth` to `CropRotateEditorStyle`, allowing the grid line thickness to be customized or hidden entirely by setting it to `0`. ## 12.0.2 diff --git a/lib/core/models/editor_configs/crop_rotate_editor_configs.dart b/lib/core/models/editor_configs/crop_rotate_editor_configs.dart index 908884d9..b7e940f0 100644 --- a/lib/core/models/editor_configs/crop_rotate_editor_configs.dart +++ b/lib/core/models/editor_configs/crop_rotate_editor_configs.dart @@ -51,6 +51,7 @@ class CropRotateEditorConfigs implements BaseSubEditorConfigs { this.invertMouseScroll = false, this.invertDragDirection = false, this.initialCropMode = CropMode.rectangular, + this.exportOvalMask = true, this.enableTransformLayers = true, this.enableProvideImageInfos = false, this.enableDoubleTap = true, @@ -132,6 +133,14 @@ class CropRotateEditorConfigs implements BaseSubEditorConfigs { /// presented to the user before any manual adjustments are made. final CropMode initialCropMode; + /// Controls whether the oval mask is applied to the exported image when + /// [initialCropMode] is set to [CropMode.oval]. + /// + /// When `true` (default), the exported image is clipped to an oval/circle + /// shape. When `false`, the raw rectangular crop is exported without any + /// oval masking, while the oval UI is still shown inside the crop editor. + final bool exportOvalMask; + /// Defines which crop-rotate tools are available in the editor. /// /// The order of the tools in this list determines the order in the UI. @@ -259,6 +268,7 @@ class CropRotateEditorConfigs implements BaseSubEditorConfigs { bool? invertMouseScroll, bool? invertDragDirection, CropMode? initialCropMode, + bool? exportOvalMask, List? tools, bool? enableProvideImageInfos, double? initAspectRatio, @@ -294,6 +304,7 @@ class CropRotateEditorConfigs implements BaseSubEditorConfigs { invertMouseScroll: invertMouseScroll ?? this.invertMouseScroll, invertDragDirection: invertDragDirection ?? this.invertDragDirection, initialCropMode: initialCropMode ?? this.initialCropMode, + exportOvalMask: exportOvalMask ?? this.exportOvalMask, tools: tools ?? this.tools, enableProvideImageInfos: enableProvideImageInfos ?? this.enableProvideImageInfos, diff --git a/lib/shared/widgets/transform/transformed_content_generator.dart b/lib/shared/widgets/transform/transformed_content_generator.dart index 22477804..c3046e11 100644 --- a/lib/shared/widgets/transform/transformed_content_generator.dart +++ b/lib/shared/widgets/transform/transformed_content_generator.dart @@ -143,12 +143,17 @@ class TransformedContentGenerator extends StatelessWidget { CropMode cropMode = _transformConfigs.cropMode; + final effectiveCropMode = + cropMode == CropMode.oval && !configs.cropRotateEditor.exportOvalMask + ? CropMode.rectangular + : cropMode; + final clipper = CutOutsideArea( configs: _transformConfigs, - cropMode: cropMode, + cropMode: effectiveCropMode, ); - if (cropMode == CropMode.oval) { + if (effectiveCropMode == CropMode.oval) { return ClipOval(clipper: clipper, child: child); } else { return ClipRect(clipper: clipper, child: child);