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

Is CGImageWithCorrectOrientation really necessary? #45

Open
kean opened this issue Sep 25, 2016 · 1 comment
Open

Is CGImageWithCorrectOrientation really necessary? #45

kean opened this issue Sep 25, 2016 · 1 comment

Comments

@kean
Copy link
Contributor

kean commented Sep 25, 2016

Hey! I just noticed that each operation in Toucan starts off with a call to CGImageWithCorrectOrientation function which involves creating a new context and drawing an image into it. So, for example, if I want to crop an image with UIImageOrientation.Left then instead of simply cropping the image (which is extremely fast) Toucan would first physically rotate its bitmap (which is much more expensive then cropping itself) and just then crop the image. It would also change the image orientation to UIImageOrientation.Up.

I understand that it might be tempting to just "fix" an orientation so that all the other functions would only have to deal with images in UIImageOrientation.Up. However, if would be nice if Toucan could add a proper support for images in all orientations.

@gavinbunney
Copy link
Owner

Indeed it is more a ground-work-ensure-all-the-things. Ideally Toucan wouldn't actually perform the operations when called, but have a more optimistic-builder-style syntax, and only perform the operations when retrieving the image property, so at that point we could optimize the callstack and remove the redundant calls.... happy for PR or hopefully I'll get there :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants