Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crop image to circle #1

Merged
merged 2 commits into from
Jan 23, 2024
Merged

Crop image to circle #1

merged 2 commits into from
Jan 23, 2024

Conversation

leoz
Copy link
Contributor

@leoz leoz commented Jan 23, 2024

No description provided.

@@ -120,6 +120,14 @@ struct CropView: View {
.background(.black)
}

private func cropImage() -> UIImage? {
if maskShape == .circle {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @leoz I really appreciate your contribution!

It's a great idea to offer the ability to crop the image with a circle mask to an actual circular image. However, most cropping mechanisms I have used to build this library always crop the image as a square. The image is then displayed in a mask (e.g. circle). The actual image is still a square in the background, this is expected in most cases I use this library.

I think it is still a good idea to offer the ability to crop the image as a circle. I would however like to make this a configuration option when using the CropView. Could you add it into the SwiftyCropConfiguration e.g. as cropImageCircular: Bool with a default value of false? I will then adjust the README.

Best Regards
Ben

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @benedom , thank you!
I will do as you suggest and update the pull request.
Thank you!

@leoz
Copy link
Contributor Author

leoz commented Jan 23, 2024

@benedom, updated as you suggested.

@benedom benedom merged commit d128aa7 into benedom:master Jan 23, 2024
1 check passed
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.

2 participants