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

WIP: Added .scaleMode decode options and context option to allows aspect fill thumbnail #3628

Closed

Conversation

dreampiggy
Copy link
Contributor

New Pull Request Checklist

  • I have read and understood the CONTRIBUTING guide

  • I have read the Documentation

  • I have searched for a similar pull request in the project and found none

  • I have updated this branch with the latest master to avoid conflicts (via merge from master or rebase)

  • I have added the required tests to prove the fix/feature I am adding

  • I have updated the documentation (if necessary)

  • I have run the tests and they pass

  • I have run the lint and it passes (pod lib lint)

This merge request fixes / refers to the following issues: ...

Pull Request Description

This is useful for user who want to use the aspect fill content mode on image view level to make image more sharp

This close #3622

Behavior Changes

  1. If the coder does not response to the .scaleMode options, it should always use the aspect fit instead.
  2. The coder must response to the old version .preserveAspectRatio option for history compatible, until we reached v6.0.0
  3. The SDThumbnailedKeyForKey change arg from BOOL to NSUInteger, but this is binary compatible changes, and the thumbnail cache is still valid (because .aspectFit == YES == 1, and .fill == NO == 0)

… fill thumbnail

This is useful for user who want to use the aspect fill content mode on image view level to make image more sharp
…ible

This still valid for old version cache because `.aspectFit` == `YES` == 1, and `.fill` == `NO` == 0
@@ -57,7 +57,7 @@ + (instancetype)sharedCoder {
}

#pragma mark - Bitmap PDF representation
+ (UIImage *)createBitmapPDFWithData:(nonnull NSData *)data pageNumber:(NSUInteger)pageNumber targetSize:(CGSize)targetSize preserveAspectRatio:(BOOL)preserveAspectRatio {
+ (UIImage *)createBitmapPDFWithData:(nonnull NSData *)data pageNumber:(NSUInteger)pageNumber targetSize:(CGSize)targetSize scaleMode:(SDImageScaleMode)scaleMode {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This effects https://github.com/SDWebImage/SDWebImagePDFCoder

Because that coder use this private API :)

@dreampiggy dreampiggy changed the title Added .scaleMode decode options and context option to allows aspect fill thumbnail WIP: Added .scaleMode decode options and context option to allows aspect fill thumbnail Oct 27, 2023
@dreampiggy dreampiggy marked this pull request as draft October 27, 2023 08:17
@dreampiggy
Copy link
Contributor Author

Decided to not support this feature. Which cause massive break changes (include SVG/PDF vector image)

@dreampiggy dreampiggy closed this Feb 24, 2024
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.

Feature request: more flexibility in specifying thumbnail sizes
1 participant