Skip to content

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

Merged
dreampiggy merged 1 commit into
SDWebImage:masterfrom
Maxador:master
Dec 14, 2020
Merged

Allow constraining bitmap on one length only (width or height)#28
dreampiggy merged 1 commit into
SDWebImage:masterfrom
Maxador:master

Conversation

@Maxador
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator

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

@Maxador
Copy link
Copy Markdown
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
Copy Markdown
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