Added `SDWebImageTransformVectorImage`, which can allows the transformer to transform the vector image format, although most coders works for vector format (if you don't grab CGImage), some are not
This commit is contained in:
parent
ef2373668e
commit
5629af8330
|
@ -195,6 +195,12 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) {
|
|||
* Note if you use this when using the custom cache serializer, or using the transformer, we will also wait until the output image data written is finished.
|
||||
*/
|
||||
SDWebImageWaitStoreCache = 1 << 22,
|
||||
|
||||
/**
|
||||
* We usually don't apply transform on vector images, because vector images supports dynamically changing to any size, rasterize to a fixed size will loss details. To modify vector images, you can process the vector data at runtime (such as modifying PDF tag / SVG element).
|
||||
* Use this flag to transform them anyway.
|
||||
*/
|
||||
SDWebImageTransformVectorImage = 1 << 23,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -332,7 +332,9 @@ static id<SDImageLoader> _defaultImageLoader;
|
|||
id<SDImageTransformer> transformer = context[SDWebImageContextImageTransformer];
|
||||
id<SDWebImageCacheSerializer> cacheSerializer = context[SDWebImageContextCacheSerializer];
|
||||
|
||||
BOOL shouldTransformImage = downloadedImage && (!downloadedImage.sd_isAnimated || (options & SDWebImageTransformAnimatedImage)) && transformer;
|
||||
BOOL shouldTransformImage = downloadedImage && transformer;
|
||||
shouldTransformImage = shouldTransformImage && (!downloadedImage.sd_isAnimated || (options & SDWebImageTransformAnimatedImage));
|
||||
shouldTransformImage = shouldTransformImage && (!downloadedImage.sd_isVector || (options & SDWebImageTransformVectorImage));
|
||||
BOOL shouldCacheOriginal = downloadedImage && finished;
|
||||
BOOL waitStoreCache = SD_OPTIONS_CONTAINS(options, SDWebImageWaitStoreCache);
|
||||
|
||||
|
@ -380,7 +382,9 @@ static id<SDImageLoader> _defaultImageLoader;
|
|||
NSString *key = [self cacheKeyForURL:url context:context];
|
||||
id<SDImageTransformer> transformer = context[SDWebImageContextImageTransformer];
|
||||
id<SDWebImageCacheSerializer> cacheSerializer = context[SDWebImageContextCacheSerializer];
|
||||
BOOL shouldTransformImage = originalImage && (!originalImage.sd_isAnimated || (options & SDWebImageTransformAnimatedImage)) && transformer;
|
||||
BOOL shouldTransformImage = originalImage && transformer;
|
||||
shouldTransformImage = shouldTransformImage && (!originalImage.sd_isAnimated || (options & SDWebImageTransformAnimatedImage));
|
||||
shouldTransformImage = shouldTransformImage && (!originalImage.sd_isVector || (options & SDWebImageTransformVectorImage));
|
||||
BOOL waitStoreCache = SD_OPTIONS_CONTAINS(options, SDWebImageWaitStoreCache);
|
||||
// if available, store transformed image to cache
|
||||
if (shouldTransformImage) {
|
||||
|
|
Loading…
Reference in New Issue