Fix alpha not applying to tinted image by exponentChoi · Pull Request #3748 · SDWebImage/SDWebImage
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
Fix the issue where alpha values do not apply to the image.
While using SDWebImage, I discovered that the alpha value for the image color was not being applied. The issue was caused by the CGBlendMode setting. When using kCGBlendModeSourceATop as before, the A color was being overwritten. To resolve this, I switched to using kCGBlendModeSourceIn, which effectively replaced the color. This change ensures that the alpha value is applied to the tintColor of UIImage, similar to how it behaves natively. I discovered this issue while testing with SVG images.
Reference
documentation - https://developer.apple.com/documentation/coregraphics/cgblendmode/