Skip to content

Implement Aspect Ratio Cropping#1

Merged
Tanish-Ranjan merged 1 commit into
mainfrom
feat/arbitrary-crop-ratio
Jun 22, 2025
Merged

Implement Aspect Ratio Cropping#1
Tanish-Ranjan merged 1 commit into
mainfrom
feat/arbitrary-crop-ratio

Conversation

@Tanish-Ranjan
Copy link
Copy Markdown
Owner

Description

This update now developers to apply any desired aspect ratio for the crop rectangle.

Changes

  • Refactored CropShape with a new AspectRatio option to allow cropping with fixed aspect ratios.
  • Added CropShape.Original to maintain the image's original aspect ratio.
  • Renamed Gridlines enum to GridLinesVisibility for clarity.
  • Introduced a new enum GridLinesType customize the visual appearance of gridlines.
  • Updated CropOptions to include gridLinesType.
  • Modified ImageCropper to draw gridlines based on gridLinesType and gridLinesVisibility.
  • The dark overlay outside the crop area now considers gridLinesType to determine its shape (rectangle or oval).
  • Updated CropStateManager to handle aspect ratio constraints during dragging and initialization.
  • Added CropRatio object with predefined common aspect ratios.
  • Updated the demo app to showcase new aspect ratio and gridline features.
  • Bumped library version to 1.1.0.
  • Removed isSquareBounds() extension function as it's no longer needed with the new CropShape sealed class.
    Please include a summary of the changes and the related issue. Please also include relevant
    motivation and context. List any dependencies that are required for this change.

Type of change

  • New feature (non-breaking change which adds functionality)

Changes:
- Refactored `CropShape` with a new `AspectRatio` option to allow cropping with fixed aspect ratios.
- Added `CropShape.Original` to maintain the image's original aspect ratio.
- Renamed `Gridlines` enum to `GridLinesVisibility` for clarity.
- Introduced a new enum `GridLinesType` customize the visual appearance of gridlines.
- Updated `CropOptions` to include `gridLinesType`.
- Modified `ImageCropper` to draw gridlines based on `gridLinesType` and `gridLinesVisibility`.
- The dark overlay outside the crop area now considers `gridLinesType` to determine its shape (rectangle or oval).
- Updated `CropStateManager` to handle aspect ratio constraints during dragging and initialization.
- Added `CropRatio` object with predefined common aspect ratios.
- Updated the demo app to showcase new aspect ratio and gridline features.
- Bumped library version to 1.1.0.
- Removed `isSquareBounds()` extension function as it's no longer needed with the new `CropShape` sealed class.
@Tanish-Ranjan Tanish-Ranjan merged commit 6b2d873 into main Jun 22, 2025
@Tanish-Ranjan Tanish-Ranjan deleted the feat/arbitrary-crop-ratio branch June 22, 2025 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant