Skip to content

Allow constraining bitmap on one length only (width or height) #28

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

Merged
merged 1 commit into from
Dec 14, 2020

Conversation

Maxador
Copy link
Contributor

@Maxador Maxador commented Dec 11, 2020

Fix: #27

All the svgs are constrained to 34pt high
Simulator Screen Shot - Apple Watch Series 6 - 44mm - 2020-12-11 at 11 25 11

Adjust target rectSize to respect ratio
@dreampiggy
Copy link
Collaborator

dreampiggy commented Dec 14, 2020

This sounds like new feature request.

Any better idea instead of this sucking length == 0 means keep length and use aspect ratio ? This sounds not a good design.


If we have no other good solution to let user provide this context (I want to keep length limit, width based on calculation), maybe this is the only way.

@dreampiggy
Copy link
Collaborator

And if you change this, we'd better update the code and comments in both https://github.com/SDWebImage/SDWebImagePDFCoder and https://github.com/SDWebImage/SDWebImage.

@dreampiggy
Copy link
Collaborator

I'll decide to merge this and update code comments as well.
Then I need to sync this PR into SDWebImage Core and SDWebImagePDFCoder (Another vector format), which have the same use case.

@dreampiggy
Copy link
Collaborator

@Maxador I extend the both preserve aspect ratio and non-preserve aspect ratio cases for 0 length. See #29

@Maxador
Copy link
Contributor Author

Maxador commented Dec 14, 2020

Very nice! Thank you!
For adding to your suggestion of not hijacking the Size context for that, we could add a new context option. Something like LengthConstraint that could take a length type (enum for width or height) and a length value (CGFloat).

@dreampiggy
Copy link
Collaborator

dreampiggy commented Dec 16, 2020

For SVG bitmap image (such as watchOS), new version available in 1.6.0

If you want to keep aspect ratio, and does not know about What's the size of this SVG URL ? this inforamtion. You can provide width or height to 0, which means ignore the limit.

See more complicated rules in README-Render SVG as bitmap image

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.

Small SVG renders blurry on watchOS
2 participants