Merge pull request #2304 from dreampiggy/renaming_image_transformer

Renaming image transformer
This commit is contained in:
Bogdan Poplauschi 2018-04-26 18:49:52 +03:00 committed by GitHub
commit 5bedca7473
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 116 additions and 116 deletions

View File

@ -559,18 +559,18 @@
32F21B5A20788D8C0036B1D5 /* SDWebImageDownloaderRequestModifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F21B5020788D8C0036B1D5 /* SDWebImageDownloaderRequestModifier.m */; };
32F21B5B20788D8C0036B1D5 /* SDWebImageDownloaderRequestModifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F21B5020788D8C0036B1D5 /* SDWebImageDownloaderRequestModifier.m */; };
32F21B5C20788D8C0036B1D5 /* SDWebImageDownloaderRequestModifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F21B5020788D8C0036B1D5 /* SDWebImageDownloaderRequestModifier.m */; };
32F7C06F2030114C00873181 /* SDWebImageTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 32F7C06D2030114C00873181 /* SDWebImageTransformer.h */; settings = {ATTRIBUTES = (Public, ); }; };
32F7C0702030114C00873181 /* SDWebImageTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 32F7C06D2030114C00873181 /* SDWebImageTransformer.h */; settings = {ATTRIBUTES = (Public, ); }; };
32F7C0712030114C00873181 /* SDWebImageTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 32F7C06D2030114C00873181 /* SDWebImageTransformer.h */; settings = {ATTRIBUTES = (Public, ); }; };
32F7C0722030114C00873181 /* SDWebImageTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 32F7C06D2030114C00873181 /* SDWebImageTransformer.h */; settings = {ATTRIBUTES = (Public, ); }; };
32F7C0732030114C00873181 /* SDWebImageTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 32F7C06D2030114C00873181 /* SDWebImageTransformer.h */; settings = {ATTRIBUTES = (Public, ); }; };
32F7C0742030114C00873181 /* SDWebImageTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 32F7C06D2030114C00873181 /* SDWebImageTransformer.h */; settings = {ATTRIBUTES = (Public, ); }; };
32F7C0752030114C00873181 /* SDWebImageTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F7C06E2030114C00873181 /* SDWebImageTransformer.m */; };
32F7C0762030114C00873181 /* SDWebImageTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F7C06E2030114C00873181 /* SDWebImageTransformer.m */; };
32F7C0772030114C00873181 /* SDWebImageTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F7C06E2030114C00873181 /* SDWebImageTransformer.m */; };
32F7C0782030114C00873181 /* SDWebImageTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F7C06E2030114C00873181 /* SDWebImageTransformer.m */; };
32F7C0792030114C00873181 /* SDWebImageTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F7C06E2030114C00873181 /* SDWebImageTransformer.m */; };
32F7C07A2030114C00873181 /* SDWebImageTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F7C06E2030114C00873181 /* SDWebImageTransformer.m */; };
32F7C06F2030114C00873181 /* SDImageTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 32F7C06D2030114C00873181 /* SDImageTransformer.h */; settings = {ATTRIBUTES = (Public, ); }; };
32F7C0702030114C00873181 /* SDImageTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 32F7C06D2030114C00873181 /* SDImageTransformer.h */; settings = {ATTRIBUTES = (Public, ); }; };
32F7C0712030114C00873181 /* SDImageTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 32F7C06D2030114C00873181 /* SDImageTransformer.h */; settings = {ATTRIBUTES = (Public, ); }; };
32F7C0722030114C00873181 /* SDImageTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 32F7C06D2030114C00873181 /* SDImageTransformer.h */; settings = {ATTRIBUTES = (Public, ); }; };
32F7C0732030114C00873181 /* SDImageTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 32F7C06D2030114C00873181 /* SDImageTransformer.h */; settings = {ATTRIBUTES = (Public, ); }; };
32F7C0742030114C00873181 /* SDImageTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 32F7C06D2030114C00873181 /* SDImageTransformer.h */; settings = {ATTRIBUTES = (Public, ); }; };
32F7C0752030114C00873181 /* SDImageTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F7C06E2030114C00873181 /* SDImageTransformer.m */; };
32F7C0762030114C00873181 /* SDImageTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F7C06E2030114C00873181 /* SDImageTransformer.m */; };
32F7C0772030114C00873181 /* SDImageTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F7C06E2030114C00873181 /* SDImageTransformer.m */; };
32F7C0782030114C00873181 /* SDImageTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F7C06E2030114C00873181 /* SDImageTransformer.m */; };
32F7C0792030114C00873181 /* SDImageTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F7C06E2030114C00873181 /* SDImageTransformer.m */; };
32F7C07A2030114C00873181 /* SDImageTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F7C06E2030114C00873181 /* SDImageTransformer.m */; };
32F7C07E2030719600873181 /* UIImage+Transform.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F7C07C2030719600873181 /* UIImage+Transform.m */; };
32F7C07F2030719600873181 /* UIImage+Transform.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F7C07C2030719600873181 /* UIImage+Transform.m */; };
32F7C0802030719600873181 /* UIImage+Transform.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F7C07C2030719600873181 /* UIImage+Transform.m */; };
@ -1630,8 +1630,8 @@
32D1221D2080B2EB003685A3 /* SDImageCachesManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDImageCachesManager.h; sourceTree = "<group>"; };
32F21B4F20788D8C0036B1D5 /* SDWebImageDownloaderRequestModifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDWebImageDownloaderRequestModifier.h; sourceTree = "<group>"; };
32F21B5020788D8C0036B1D5 /* SDWebImageDownloaderRequestModifier.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDWebImageDownloaderRequestModifier.m; sourceTree = "<group>"; };
32F7C06D2030114C00873181 /* SDWebImageTransformer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDWebImageTransformer.h; sourceTree = "<group>"; };
32F7C06E2030114C00873181 /* SDWebImageTransformer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDWebImageTransformer.m; sourceTree = "<group>"; };
32F7C06D2030114C00873181 /* SDImageTransformer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDImageTransformer.h; sourceTree = "<group>"; };
32F7C06E2030114C00873181 /* SDImageTransformer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDImageTransformer.m; sourceTree = "<group>"; };
32F7C07C2030719600873181 /* UIImage+Transform.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Transform.m"; sourceTree = "<group>"; };
32F7C07D2030719600873181 /* UIImage+Transform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+Transform.h"; sourceTree = "<group>"; };
32FDE87A2088871B008D7530 /* MKAnnotationView+WebCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MKAnnotationView+WebCache.m"; sourceTree = "<group>"; };
@ -1976,8 +1976,8 @@
328BB6992081FDDF00760D6C /* Transformer */ = {
isa = PBXGroup;
children = (
32F7C06D2030114C00873181 /* SDWebImageTransformer.h */,
32F7C06E2030114C00873181 /* SDWebImageTransformer.m */,
32F7C06D2030114C00873181 /* SDImageTransformer.h */,
32F7C06E2030114C00873181 /* SDImageTransformer.m */,
);
name = Transformer;
sourceTree = "<group>";
@ -2474,7 +2474,7 @@
32C0FDE42013426C001B8F2D /* SDWebImageIndicator.h in Headers */,
321E60C11F38E91700405457 /* UIImage+ForceDecode.h in Headers */,
80377DBE1F2F66A700F89830 /* dsp.h in Headers */,
32F7C0722030114C00873181 /* SDWebImageTransformer.h in Headers */,
32F7C0722030114C00873181 /* SDImageTransformer.h in Headers */,
80377EB81F2F66D400F89830 /* alphai_dec.h in Headers */,
00733A6D1BC4880E00A5A117 /* UIImage+GIF.h in Headers */,
80377C551F2F666300F89830 /* quant_levels_dec_utils.h in Headers */,
@ -2506,7 +2506,7 @@
80377C141F2F666300F89830 /* bit_reader_utils.h in Headers */,
328BB69D2081FED200760D6C /* SDWebImageCacheKeyFilter.h in Headers */,
323F8C0F1F38EF770092B609 /* muxi.h in Headers */,
32F7C0702030114C00873181 /* SDWebImageTransformer.h in Headers */,
32F7C0702030114C00873181 /* SDImageTransformer.h in Headers */,
80377C2B1F2F666300F89830 /* utils.h in Headers */,
4314D1621D0E0E3B004B36C9 /* mux_types.h in Headers */,
4314D1631D0E0E3B004B36C9 /* demux.h in Headers */,
@ -2665,7 +2665,7 @@
807A122C1F89636300EC2A9B /* SDWebImageCodersManager.h in Headers */,
323F8BFA1F38EF770092B609 /* animi.h in Headers */,
431BB6F91D06D2C1006A3455 /* UIImage+GIF.h in Headers */,
32F7C0732030114C00873181 /* SDWebImageTransformer.h in Headers */,
32F7C0732030114C00873181 /* SDImageTransformer.h in Headers */,
431BB6FA1D06D2C1006A3455 /* SDWebImageDownloader.h in Headers */,
3248476D201775F600AF9E5A /* SDAnimatedImageView.h in Headers */,
32D122222080B2EB003685A3 /* SDImageCacheDefine.h in Headers */,
@ -2734,7 +2734,7 @@
32CF1C0C1FA496B000004BD1 /* SDWebImageCoderHelper.h in Headers */,
43A918691D8308FE00B3925F /* SDImageCacheConfig.h in Headers */,
4397D2D81D0DDD8C00BB2784 /* UIButton+WebCache.h in Headers */,
32F7C0742030114C00873181 /* SDWebImageTransformer.h in Headers */,
32F7C0742030114C00873181 /* SDImageTransformer.h in Headers */,
80377E641F2F66A800F89830 /* mips_macro.h in Headers */,
328BB6D22082581100760D6C /* SDMemoryCache.h in Headers */,
323F8BDD1F38EF770092B609 /* vp8i_enc.h in Headers */,
@ -2870,7 +2870,7 @@
32C0FDE32013426C001B8F2D /* SDWebImageIndicator.h in Headers */,
80377D791F2F66A700F89830 /* dsp.h in Headers */,
80377EA81F2F66D400F89830 /* alphai_dec.h in Headers */,
32F7C0712030114C00873181 /* SDWebImageTransformer.h in Headers */,
32F7C0712030114C00873181 /* SDImageTransformer.h in Headers */,
4A2CAE2D1AB4BB7500B6BC39 /* UIImage+GIF.h in Headers */,
80377C3B1F2F666300F89830 /* quant_levels_dec_utils.h in Headers */,
80377EB11F2F66D400F89830 /* vp8_dec.h in Headers */,
@ -2930,7 +2930,7 @@
32FDE8802088871B008D7530 /* MKAnnotationView+WebCache.h in Headers */,
321E60BE1F38E91700405457 /* UIImage+ForceDecode.h in Headers */,
5376131E155AD0D5005750A4 /* SDWebImagePrefetcher.h in Headers */,
32F7C06F2030114C00873181 /* SDWebImageTransformer.h in Headers */,
32F7C06F2030114C00873181 /* SDImageTransformer.h in Headers */,
321B378D2083290E00C0EA77 /* SDWebImageLoadersManager.h in Headers */,
32FDE8A220888789008D7530 /* SDWebImage.h in Headers */,
324DF4B4200A14DC008A84CC /* SDWebImageDefine.h in Headers */,
@ -3233,7 +3233,7 @@
323F8B7D1F38EF770092B609 /* frame_enc.c in Sources */,
328BB6D62082581100760D6C /* SDMemoryCache.m in Sources */,
80377EBB1F2F66D500F89830 /* frame_dec.c in Sources */,
32F7C0782030114C00873181 /* SDWebImageTransformer.m in Sources */,
32F7C0782030114C00873181 /* SDImageTransformer.m in Sources */,
80377DAF1F2F66A700F89830 /* argb.c in Sources */,
323F8B6B1F38EF770092B609 /* delta_palettization_enc.c in Sources */,
00733A5B1BC4880000A5A117 /* NSData+ImageContentType.m in Sources */,
@ -3479,7 +3479,7 @@
4314D1411D0E0E3B004B36C9 /* SDWebImageDownloaderOperation.m in Sources */,
80377D561F2F66A700F89830 /* rescaler_neon.c in Sources */,
32B9B53E206ED4230026769D /* SDWebImageDownloaderConfig.m in Sources */,
32F7C0762030114C00873181 /* SDWebImageTransformer.m in Sources */,
32F7C0762030114C00873181 /* SDImageTransformer.m in Sources */,
80377D551F2F66A700F89830 /* rescaler_msa.c in Sources */,
80377D5E1F2F66A700F89830 /* yuv_mips_dsp_r2.c in Sources */,
80377D611F2F66A700F89830 /* yuv.c in Sources */,
@ -3645,7 +3645,7 @@
3237F9EA20161AE000A88143 /* NSImage+Compatibility.m in Sources */,
80377E251F2F66A800F89830 /* rescaler_neon.c in Sources */,
32B9B541206ED4230026769D /* SDWebImageDownloaderConfig.m in Sources */,
32F7C0792030114C00873181 /* SDWebImageTransformer.m in Sources */,
32F7C0792030114C00873181 /* SDImageTransformer.m in Sources */,
80377E241F2F66A800F89830 /* rescaler_msa.c in Sources */,
80377E2D1F2F66A800F89830 /* yuv_mips_dsp_r2.c in Sources */,
431BB6B91D06D2C1006A3455 /* UIButton+WebCache.m in Sources */,
@ -3858,7 +3858,7 @@
80377EE51F2F66D500F89830 /* webp_dec.c in Sources */,
4397D2B01D0DDD8C00BB2784 /* SDImageCache.m in Sources */,
321B37982083290E00C0EA77 /* SDWebImageLoadersManager.m in Sources */,
32F7C07A2030114C00873181 /* SDWebImageTransformer.m in Sources */,
32F7C07A2030114C00873181 /* SDImageTransformer.m in Sources */,
80377E4F1F2F66A800F89830 /* enc_sse41.c in Sources */,
80377E701F2F66A800F89830 /* upsampling_sse2.c in Sources */,
);
@ -3902,7 +3902,7 @@
323F8B7C1F38EF770092B609 /* frame_enc.c in Sources */,
328BB6D52082581100760D6C /* SDMemoryCache.m in Sources */,
80377EAB1F2F66D400F89830 /* frame_dec.c in Sources */,
32F7C0772030114C00873181 /* SDWebImageTransformer.m in Sources */,
32F7C0772030114C00873181 /* SDImageTransformer.m in Sources */,
43C8929D1D9D6DD90022038D /* anim_decode.c in Sources */,
323F8B6A1F38EF770092B609 /* delta_palettization_enc.c in Sources */,
43CE75D41CFE98E0006C64D0 /* FLAnimatedImageView+WebCache.m in Sources */,
@ -4073,7 +4073,7 @@
80377E8B1F2F66D000F89830 /* frame_dec.c in Sources */,
328BB6D32082581100760D6C /* SDMemoryCache.m in Sources */,
43C8929A1D9D6DD70022038D /* anim_decode.c in Sources */,
32F7C0752030114C00873181 /* SDWebImageTransformer.m in Sources */,
32F7C0752030114C00873181 /* SDImageTransformer.m in Sources */,
323F8B681F38EF770092B609 /* delta_palettization_enc.c in Sources */,
43CE75D31CFE98E0006C64D0 /* FLAnimatedImageView+WebCache.m in Sources */,
323F8B5C1F38EF770092B609 /* cost_enc.c in Sources */,

View File

@ -12,7 +12,7 @@
#import "NSImage+Compatibility.h"
#import "UIImage+WebCache.h"
#import "SDWebImageCodersManager.h"
#import "SDWebImageTransformer.h"
#import "SDImageTransformer.h"
#import "SDWebImageCoderHelper.h"
#import "SDAnimatedImage.h"
@ -371,9 +371,9 @@
cacheType = SDImageCacheTypeMemory;
} else if (diskData) {
NSString *cacheKey = key;
if ([context valueForKey:SDWebImageContextCustomTransformer]) {
if ([context valueForKey:SDWebImageContextImageTransformer]) {
// grab the transformed disk image if transformer provided
id<SDWebImageTransformer> transformer = [context valueForKey:SDWebImageContextCustomTransformer];
id<SDImageTransformer> transformer = [context valueForKey:SDWebImageContextImageTransformer];
NSString *transformerKey = [transformer transformerKey];
cacheKey = SDTransformedKeyForKey(key, transformerKey);
}

View File

@ -20,11 +20,11 @@ FOUNDATION_EXPORT NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullab
/**
A transformer protocol to transform the image load from cache or from download.
You can provide transformer to cache and manager (Through the `transformer` property or context option `SDWebImageContextCustomTransformer`).
You can provide transformer to cache and manager (Through the `transformer` property or context option `SDWebImageContextImageTransformer`).
@note The transform process is called from a global queue in order to not to block the main queue.
*/
@protocol SDWebImageTransformer <NSObject>
@protocol SDImageTransformer <NSObject>
@required
/**
@ -49,12 +49,12 @@ FOUNDATION_EXPORT NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullab
// Pipeline transformer. Which you can bind multiple transformers together to let the image to be transformed one by one in order and generate the final image.
// Because transformers are lightweight, if you want to append or arrange transfomers, create another pipeline transformer instead. This class is considered as immutable.
@interface SDWebImagePipelineTransformer : NSObject <SDWebImageTransformer>
@interface SDImagePipelineTransformer : NSObject <SDImageTransformer>
@property (nonatomic, copy, readonly, nonnull) NSArray<id<SDWebImageTransformer>> *transformers;
@property (nonatomic, copy, readonly, nonnull) NSArray<id<SDImageTransformer>> *transformers;
- (nonnull instancetype)init NS_UNAVAILABLE;
+ (nonnull instancetype)transformerWithTransformers:(nonnull NSArray<id<SDWebImageTransformer>> *)transformers;
+ (nonnull instancetype)transformerWithTransformers:(nonnull NSArray<id<SDImageTransformer>> *)transformers;
@end
@ -63,7 +63,7 @@ FOUNDATION_EXPORT NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullab
#pragma mark - Image Geometry
// Image round corner transformer
@interface SDWebImageRoundCornerTransformer: NSObject <SDWebImageTransformer>
@interface SDImageRoundCornerTransformer: NSObject <SDImageTransformer>
@property (nonatomic, assign, readonly) CGFloat cornerRadius;
@property (nonatomic, assign, readonly) SDRectCorner corners;
@ -76,7 +76,7 @@ FOUNDATION_EXPORT NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullab
@end
// Image resizing transformer
@interface SDWebImageResizingTransformer : NSObject <SDWebImageTransformer>
@interface SDImageResizingTransformer : NSObject <SDImageTransformer>
@property (nonatomic, assign, readonly) CGSize size;
@property (nonatomic, assign, readonly) SDImageScaleMode scaleMode;
@ -87,7 +87,7 @@ FOUNDATION_EXPORT NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullab
@end
// Image cropping transformer
@interface SDWebImageCroppingTransformer : NSObject <SDWebImageTransformer>
@interface SDImageCroppingTransformer : NSObject <SDImageTransformer>
@property (nonatomic, assign, readonly) CGRect rect;
@ -97,7 +97,7 @@ FOUNDATION_EXPORT NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullab
@end
// Image flipping transformer
@interface SDWebImageFlippingTransformer : NSObject <SDWebImageTransformer>
@interface SDImageFlippingTransformer : NSObject <SDImageTransformer>
@property (nonatomic, assign, readonly) BOOL horizontal;
@property (nonatomic, assign, readonly) BOOL vertical;
@ -108,7 +108,7 @@ FOUNDATION_EXPORT NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullab
@end
// Image rotation transformer
@interface SDWebImageRotationTransformer : NSObject <SDWebImageTransformer>
@interface SDImageRotationTransformer : NSObject <SDImageTransformer>
@property (nonatomic, assign, readonly) CGFloat angle;
@property (nonatomic, assign, readonly) BOOL fitSize;
@ -121,7 +121,7 @@ FOUNDATION_EXPORT NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullab
#pragma mark - Image Blending
// Image tint color transformer
@interface SDWebImageTintTransformer : NSObject <SDWebImageTransformer>
@interface SDImageTintTransformer : NSObject <SDImageTransformer>
@property (nonatomic, strong, readonly, nonnull) UIColor *tintColor;
@ -133,7 +133,7 @@ FOUNDATION_EXPORT NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullab
#pragma mark - Image Effect
// Image blur effect transformer
@interface SDWebImageBlurTransformer : NSObject <SDWebImageTransformer>
@interface SDImageBlurTransformer : NSObject <SDImageTransformer>
@property (nonatomic, assign, readonly) CGFloat blurRadius;
@ -144,7 +144,7 @@ FOUNDATION_EXPORT NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullab
#if SD_UIKIT || SD_MAC
// Core Image filter transformer
@interface SDWebImageFilterTransformer: NSObject <SDWebImageTransformer>
@interface SDImageFilterTransformer: NSObject <SDImageTransformer>
@property (nonatomic, strong, readonly, nonnull) CIFilter *filter;

View File

@ -6,19 +6,19 @@
* file that was distributed with this source code.
*/
#import "SDWebImageTransformer.h"
#import "SDImageTransformer.h"
#if SD_UIKIT || SD_MAC
#import <CoreImage/CoreImage.h>
#endif
// Separator for different transformerKey, for example, `image.png` |> flip(YES,NO) |> rotate(pi/4,YES) => 'image-SDWebImageFlippingTransformer(1,0)-SDWebImageRotationTransformer(0.78539816339,1).png'
static NSString * const SDWebImageTransformerKeySeparator = @"-";
// Separator for different transformerKey, for example, `image.png` |> flip(YES,NO) |> rotate(pi/4,YES) => 'image-SDImageFlippingTransformer(1,0)-SDImageRotationTransformer(0.78539816339,1).png'
static NSString * const SDImageTransformerKeySeparator = @"-";
NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString * _Nonnull transformerKey) {
if (!key || !transformerKey) {
return nil;
}
return [[key stringByAppendingString:SDWebImageTransformerKeySeparator] stringByAppendingString:transformerKey];
return [[key stringByAppendingString:SDImageTransformerKeySeparator] stringByAppendingString:transformerKey];
}
@interface UIColor (HexString)
@ -63,34 +63,34 @@ NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString *
@end
@interface SDWebImagePipelineTransformer ()
@interface SDImagePipelineTransformer ()
@property (nonatomic, copy, readwrite, nonnull) NSArray<id<SDWebImageTransformer>> *transformers;
@property (nonatomic, copy, readwrite, nonnull) NSArray<id<SDImageTransformer>> *transformers;
@property (nonatomic, copy, readwrite) NSString *transformerKey;
@end
@implementation SDWebImagePipelineTransformer
@implementation SDImagePipelineTransformer
+ (instancetype)transformerWithTransformers:(NSArray<id<SDWebImageTransformer>> *)transformers {
SDWebImagePipelineTransformer *transformer = [SDWebImagePipelineTransformer new];
+ (instancetype)transformerWithTransformers:(NSArray<id<SDImageTransformer>> *)transformers {
SDImagePipelineTransformer *transformer = [SDImagePipelineTransformer new];
transformer.transformers = transformers;
transformer.transformerKey = [[self class] cacheKeyForTransformers:transformers];
return transformer;
}
+ (NSString *)cacheKeyForTransformers:(NSArray<id<SDWebImageTransformer>> *)transformers {
+ (NSString *)cacheKeyForTransformers:(NSArray<id<SDImageTransformer>> *)transformers {
if (transformers.count == 0) {
return @"";
}
NSMutableArray<NSString *> *cacheKeys = [NSMutableArray arrayWithCapacity:transformers.count];
[transformers enumerateObjectsUsingBlock:^(id<SDWebImageTransformer> _Nonnull transformer, NSUInteger idx, BOOL * _Nonnull stop) {
[transformers enumerateObjectsUsingBlock:^(id<SDImageTransformer> _Nonnull transformer, NSUInteger idx, BOOL * _Nonnull stop) {
NSString *cacheKey = transformer.transformerKey;
[cacheKeys addObject:cacheKey];
}];
return [cacheKeys componentsJoinedByString:SDWebImageTransformerKeySeparator];
return [cacheKeys componentsJoinedByString:SDImageTransformerKeySeparator];
}
- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {
@ -98,7 +98,7 @@ NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString *
return nil;
}
UIImage *transformedImage = image;
for (id<SDWebImageTransformer> transformer in self.transformers) {
for (id<SDImageTransformer> transformer in self.transformers) {
transformedImage = [transformer transformedImageWithImage:transformedImage forKey:key];
}
return transformedImage;
@ -106,7 +106,7 @@ NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString *
@end
@interface SDWebImageRoundCornerTransformer ()
@interface SDImageRoundCornerTransformer ()
@property (nonatomic, assign) CGFloat cornerRadius;
@property (nonatomic, assign) SDRectCorner corners;
@ -115,10 +115,10 @@ NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString *
@end
@implementation SDWebImageRoundCornerTransformer
@implementation SDImageRoundCornerTransformer
+ (instancetype)transformerWithRadius:(CGFloat)cornerRadius corners:(SDRectCorner)corners borderWidth:(CGFloat)borderWidth borderColor:(UIColor *)borderColor {
SDWebImageRoundCornerTransformer *transformer = [SDWebImageRoundCornerTransformer new];
SDImageRoundCornerTransformer *transformer = [SDImageRoundCornerTransformer new];
transformer.cornerRadius = cornerRadius;
transformer.corners = corners;
transformer.borderWidth = borderWidth;
@ -128,7 +128,7 @@ NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString *
}
- (NSString *)transformerKey {
return [NSString stringWithFormat:@"SDWebImageRoundCornerTransformer(%f,%lu,%f,%@)", self.cornerRadius, (unsigned long)self.corners, self.borderWidth, self.borderColor.sd_hexString];
return [NSString stringWithFormat:@"SDImageRoundCornerTransformer(%f,%lu,%f,%@)", self.cornerRadius, (unsigned long)self.corners, self.borderWidth, self.borderColor.sd_hexString];
}
- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {
@ -140,17 +140,17 @@ NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString *
@end
@interface SDWebImageResizingTransformer ()
@interface SDImageResizingTransformer ()
@property (nonatomic, assign) CGSize size;
@property (nonatomic, assign) SDImageScaleMode scaleMode;
@end
@implementation SDWebImageResizingTransformer
@implementation SDImageResizingTransformer
+ (instancetype)transformerWithSize:(CGSize)size scaleMode:(SDImageScaleMode)scaleMode {
SDWebImageResizingTransformer *transformer = [SDWebImageResizingTransformer new];
SDImageResizingTransformer *transformer = [SDImageResizingTransformer new];
transformer.size = size;
transformer.scaleMode = scaleMode;
@ -159,7 +159,7 @@ NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString *
- (NSString *)transformerKey {
CGSize size = self.size;
return [NSString stringWithFormat:@"SDWebImageResizingTransformer({%f,%f},%lu)", size.width, size.height, (unsigned long)self.scaleMode];
return [NSString stringWithFormat:@"SDImageResizingTransformer({%f,%f},%lu)", size.width, size.height, (unsigned long)self.scaleMode];
}
- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {
@ -171,16 +171,16 @@ NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString *
@end
@interface SDWebImageCroppingTransformer ()
@interface SDImageCroppingTransformer ()
@property (nonatomic, assign) CGRect rect;
@end
@implementation SDWebImageCroppingTransformer
@implementation SDImageCroppingTransformer
+ (instancetype)transformerWithRect:(CGRect)rect {
SDWebImageCroppingTransformer *transformer = [SDWebImageCroppingTransformer new];
SDImageCroppingTransformer *transformer = [SDImageCroppingTransformer new];
transformer.rect = rect;
return transformer;
@ -188,7 +188,7 @@ NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString *
- (NSString *)transformerKey {
CGRect rect = self.rect;
return [NSString stringWithFormat:@"SDWebImageCroppingTransformer({%f,%f,%f,%f})", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height];
return [NSString stringWithFormat:@"SDImageCroppingTransformer({%f,%f,%f,%f})", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height];
}
- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {
@ -200,17 +200,17 @@ NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString *
@end
@interface SDWebImageFlippingTransformer ()
@interface SDImageFlippingTransformer ()
@property (nonatomic, assign) BOOL horizontal;
@property (nonatomic, assign) BOOL vertical;
@end
@implementation SDWebImageFlippingTransformer
@implementation SDImageFlippingTransformer
+ (instancetype)transformerWithHorizontal:(BOOL)horizontal vertical:(BOOL)vertical {
SDWebImageFlippingTransformer *transformer = [SDWebImageFlippingTransformer new];
SDImageFlippingTransformer *transformer = [SDImageFlippingTransformer new];
transformer.horizontal = horizontal;
transformer.vertical = vertical;
@ -218,7 +218,7 @@ NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString *
}
- (NSString *)transformerKey {
return [NSString stringWithFormat:@"SDWebImageFlippingTransformer(%d,%d)", self.horizontal, self.vertical];
return [NSString stringWithFormat:@"SDImageFlippingTransformer(%d,%d)", self.horizontal, self.vertical];
}
- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {
@ -230,17 +230,17 @@ NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString *
@end
@interface SDWebImageRotationTransformer ()
@interface SDImageRotationTransformer ()
@property (nonatomic, assign) CGFloat angle;
@property (nonatomic, assign) BOOL fitSize;
@end
@implementation SDWebImageRotationTransformer
@implementation SDImageRotationTransformer
+ (instancetype)transformerWithAngle:(CGFloat)angle fitSize:(BOOL)fitSize {
SDWebImageRotationTransformer *transformer = [SDWebImageRotationTransformer new];
SDImageRotationTransformer *transformer = [SDImageRotationTransformer new];
transformer.angle = angle;
transformer.fitSize = fitSize;
@ -248,7 +248,7 @@ NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString *
}
- (NSString *)transformerKey {
return [NSString stringWithFormat:@"SDWebImageRotationTransformer(%f,%d)", self.angle, self.fitSize];
return [NSString stringWithFormat:@"SDImageRotationTransformer(%f,%d)", self.angle, self.fitSize];
}
- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {
@ -262,23 +262,23 @@ NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString *
#pragma mark - Image Blending
@interface SDWebImageTintTransformer ()
@interface SDImageTintTransformer ()
@property (nonatomic, strong, nonnull) UIColor *tintColor;
@end
@implementation SDWebImageTintTransformer
@implementation SDImageTintTransformer
+ (instancetype)transformerWithColor:(UIColor *)tintColor {
SDWebImageTintTransformer *transformer = [SDWebImageTintTransformer new];
SDImageTintTransformer *transformer = [SDImageTintTransformer new];
transformer.tintColor = tintColor;
return transformer;
}
- (NSString *)transformerKey {
return [NSString stringWithFormat:@"SDWebImageTintTransformer(%@)", self.tintColor.sd_hexString];
return [NSString stringWithFormat:@"SDImageTintTransformer(%@)", self.tintColor.sd_hexString];
}
- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {
@ -292,23 +292,23 @@ NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString *
#pragma mark - Image Effect
@interface SDWebImageBlurTransformer ()
@interface SDImageBlurTransformer ()
@property (nonatomic, assign) CGFloat blurRadius;
@end
@implementation SDWebImageBlurTransformer
@implementation SDImageBlurTransformer
+ (instancetype)transformerWithRadius:(CGFloat)blurRadius {
SDWebImageBlurTransformer *transformer = [SDWebImageBlurTransformer new];
SDImageBlurTransformer *transformer = [SDImageBlurTransformer new];
transformer.blurRadius = blurRadius;
return transformer;
}
- (NSString *)transformerKey {
return [NSString stringWithFormat:@"SDWebImageBlurTransformer(%f)", self.blurRadius];
return [NSString stringWithFormat:@"SDImageBlurTransformer(%f)", self.blurRadius];
}
- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {
@ -321,23 +321,23 @@ NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString *
@end
#if SD_UIKIT || SD_MAC
@interface SDWebImageFilterTransformer ()
@interface SDImageFilterTransformer ()
@property (nonatomic, strong, nonnull) CIFilter *filter;
@end
@implementation SDWebImageFilterTransformer
@implementation SDImageFilterTransformer
+ (instancetype)transformerWithFilter:(CIFilter *)filter {
SDWebImageFilterTransformer *transformer = [SDWebImageFilterTransformer new];
SDImageFilterTransformer *transformer = [SDImageFilterTransformer new];
transformer.filter = filter;
return transformer;
}
- (NSString *)transformerKey {
return [NSString stringWithFormat:@"SDWebImageFilterTransformer(%@)", self.filter.name];
return [NSString stringWithFormat:@"SDImageFilterTransformer(%@)", self.filter.name];
}
- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {

View File

@ -196,9 +196,9 @@ FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextSetIma
FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextCustomManager;
/**
A id<SDWebImageTransformer> instance which conforms SDWebImageTransformer protocol. It's used for image transform after the image load finished and store the transformed image to cache. If you provide one, it will ignore the `transformer` in manager and use provided one instead. (id<SDWebImageTransformer>)
A id<SDImageTransformer> instance which conforms `SDImageTransformer` protocol. It's used for image transform after the image load finished and store the transformed image to cache. If you provide one, it will ignore the `transformer` in manager and use provided one instead. (id<SDImageTransformer>)
*/
FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextCustomTransformer;
FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageTransformer;
/**
A CGFloat value which specify the image scale factor. The number should be greater than or equal to 1.0. If not provide or the number is invalid, we will use the cache key to specify the scale factor. (NSNumber)

View File

@ -119,7 +119,7 @@ inline UIImage * _Nullable SDScaledImageForScaleFactor(CGFloat scale, UIImage *
SDWebImageContextOption const SDWebImageContextSetImageOperationKey = @"setImageOperationKey";
SDWebImageContextOption const SDWebImageContextSetImageGroup = @"setImageGroup";
SDWebImageContextOption const SDWebImageContextCustomManager = @"customManager";
SDWebImageContextOption const SDWebImageContextCustomTransformer = @"customTransformer";
SDWebImageContextOption const SDWebImageContextImageTransformer = @"imageTransformer";
SDWebImageContextOption const SDWebImageContextImageScaleFactor = @"imageScaleFactor";
SDWebImageContextOption const SDWebImageContextAnimatedImageClass = @"animatedImageClass";
SDWebImageContextOption const SDWebImageContextDownloadRequestModifier = @"downloadRequestModifier";

View File

@ -10,7 +10,7 @@
#import "SDWebImageOperation.h"
#import "SDImageCacheDefine.h"
#import "SDWebImageDownloader.h"
#import "SDWebImageTransformer.h"
#import "SDImageTransformer.h"
#import "SDWebImageCacheKeyFilter.h"
#import "SDWebImageCacheSerializer.h"
#import "SDWebImageLoader.h"
@ -108,11 +108,11 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager];
@property (strong, nonatomic, readonly, nonnull) id<SDWebImageLoader> imageLoader;
/**
The image transformer for manager. It's used for image transform after the image load finished and store the transformed image to cache, see `SDWebImageTransformer`.
The image transformer for manager. It's used for image transform after the image load finished and store the transformed image to cache, see `SDImageTransformer`.
Defaults to nil, which means no transform is applied.
@note This will affect all the load requests for this manager if you provide. However, you can pass `SDWebImageContextCustomTransformer` in context arg to explicitly use that transformer instead.
@note This will affect all the load requests for this manager if you provide. However, you can pass `SDWebImageContextImageTransformer` in context arg to explicitly use that transformer instead.
*/
@property (strong, nonatomic, nullable) id<SDWebImageTransformer> transformer;
@property (strong, nonatomic, nullable) id<SDImageTransformer> transformer;
/**
* The cache filter is used to convert an URL into a cache key each time SDWebImageManager need cache key to use image cache.

View File

@ -280,7 +280,7 @@ static id<SDWebImageLoader> _defaultImageLoader;
}
id<SDWebImageCacheKeyFilter> cacheKeyFilter = [context valueForKey:SDWebImageContextCacheKeyFilter];
NSString *key = [self cacheKeyForURL:url cacheKeyFilter:cacheKeyFilter];
id<SDWebImageTransformer> transformer = [context valueForKey:SDWebImageContextCustomTransformer];
id<SDImageTransformer> transformer = [context valueForKey:SDWebImageContextImageTransformer];
id<SDWebImageCacheSerializer> cacheSerializer = [context valueForKey:SDWebImageContextCacheKeyFilter];
if (downloadedImage && (!downloadedImage.sd_isAnimated || (options & SDWebImageTransformAnimatedImage)) && transformer) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
@ -366,9 +366,9 @@ static id<SDWebImageLoader> _defaultImageLoader;
SDWebImageMutableContext *mutableContext = [SDWebImageMutableContext dictionary];
// Image Transformer from manager
if (![context valueForKey:SDWebImageContextCustomTransformer]) {
id<SDWebImageTransformer> transformer = self.transformer;
[mutableContext setValue:transformer forKey:SDWebImageContextCustomTransformer];
if (![context valueForKey:SDWebImageContextImageTransformer]) {
id<SDImageTransformer> transformer = self.transformer;
[mutableContext setValue:transformer forKey:SDWebImageContextImageTransformer];
}
// Cache key filter from manager
if (![context valueForKey:SDWebImageContextCacheKeyFilter]) {

View File

@ -17,8 +17,8 @@
3226ECBC20754F7700FAFACF /* SDWebImageTestDownloadOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 3226ECBA20754F7700FAFACF /* SDWebImageTestDownloadOperation.m */; };
323B8E1F20862322008952BE /* SDWebImageTestLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 323B8E1E20862322008952BE /* SDWebImageTestLoader.m */; };
323B8E2020862322008952BE /* SDWebImageTestLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 323B8E1E20862322008952BE /* SDWebImageTestLoader.m */; };
3254C32020641077008D1022 /* SDWebImageTransformerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3254C31F20641077008D1022 /* SDWebImageTransformerTests.m */; };
3254C32120641077008D1022 /* SDWebImageTransformerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3254C31F20641077008D1022 /* SDWebImageTransformerTests.m */; };
3254C32020641077008D1022 /* SDImageTransformerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3254C31F20641077008D1022 /* SDImageTransformerTests.m */; };
3254C32120641077008D1022 /* SDImageTransformerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3254C31F20641077008D1022 /* SDImageTransformerTests.m */; };
3264FF2F205D42CB00F6BD48 /* SDWebImageTestTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3264FF2E205D42CB00F6BD48 /* SDWebImageTestTransformer.m */; };
3264FF30205D42CB00F6BD48 /* SDWebImageTestTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3264FF2E205D42CB00F6BD48 /* SDWebImageTestTransformer.m */; };
327054E2206CEFF3006EA328 /* TestImageAnimated.apng in Resources */ = {isa = PBXBuildFile; fileRef = 327054E1206CEFF3006EA328 /* TestImageAnimated.apng */; };
@ -74,7 +74,7 @@
3226ECBA20754F7700FAFACF /* SDWebImageTestDownloadOperation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDWebImageTestDownloadOperation.m; sourceTree = "<group>"; };
323B8E1D20862322008952BE /* SDWebImageTestLoader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDWebImageTestLoader.h; sourceTree = "<group>"; };
323B8E1E20862322008952BE /* SDWebImageTestLoader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDWebImageTestLoader.m; sourceTree = "<group>"; };
3254C31F20641077008D1022 /* SDWebImageTransformerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDWebImageTransformerTests.m; sourceTree = "<group>"; };
3254C31F20641077008D1022 /* SDImageTransformerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDImageTransformerTests.m; sourceTree = "<group>"; };
3264FF2D205D42CB00F6BD48 /* SDWebImageTestTransformer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDWebImageTestTransformer.h; sourceTree = "<group>"; };
3264FF2E205D42CB00F6BD48 /* SDWebImageTestTransformer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDWebImageTestTransformer.m; sourceTree = "<group>"; };
327054E1206CEFF3006EA328 /* TestImageAnimated.apng */ = {isa = PBXFileReference; lastKnownFileType = file; path = TestImageAnimated.apng; sourceTree = "<group>"; };
@ -211,7 +211,7 @@
1E3C51E819B46E370092B5E6 /* SDWebImageDownloaderTests.m */,
433BBBB41D7EF5C00086B6E9 /* SDWebImageDecoderTests.m */,
4369C1D01D97F80F007E863A /* SDWebImagePrefetcherTests.m */,
3254C31F20641077008D1022 /* SDWebImageTransformerTests.m */,
3254C31F20641077008D1022 /* SDImageTransformerTests.m */,
4369C2731D9804B1007E863A /* SDWebCacheCategoriesTests.m */,
32B99E8A203AF8690017FD66 /* SDCategoriesTests.m */,
32A571552037DB2D002EDAAE /* SDAnimatedImageTest.m */,
@ -478,7 +478,7 @@
files = (
323B8E2020862322008952BE /* SDWebImageTestLoader.m in Sources */,
32B99EAC203B36650017FD66 /* SDWebImageDownloaderTests.m in Sources */,
3254C32120641077008D1022 /* SDWebImageTransformerTests.m in Sources */,
3254C32120641077008D1022 /* SDImageTransformerTests.m in Sources */,
328BB6DE20825E9800760D6C /* SDWebImageTestCache.m in Sources */,
32B99E9C203B2EE40017FD66 /* SDCategoriesTests.m in Sources */,
32B99EAA203B365F0017FD66 /* SDImageCacheTests.m in Sources */,
@ -502,7 +502,7 @@
323B8E1F20862322008952BE /* SDWebImageTestLoader.m in Sources */,
32E6F0321F3A1B4700A945E6 /* SDWebImageTestDecoder.m in Sources */,
3226ECBB20754F7700FAFACF /* SDWebImageTestDownloadOperation.m in Sources */,
3254C32020641077008D1022 /* SDWebImageTransformerTests.m in Sources */,
3254C32020641077008D1022 /* SDImageTransformerTests.m in Sources */,
32A571562037DB2D002EDAAE /* SDAnimatedImageTest.m in Sources */,
1E3C51E919B46E370092B5E6 /* SDWebImageDownloaderTests.m in Sources */,
37D122881EC48B5E00D98CEB /* SDMockFileManager.m in Sources */,

View File

@ -17,13 +17,13 @@
@end
@interface SDWebImageTransformerTests : SDTestCase
@interface SDImageTransformerTests : SDTestCase
@property (nonatomic, strong) UIImage *testImage;
@end
@implementation SDWebImageTransformerTests
@implementation SDImageTransformerTests
#pragma mark - UIImage+Transform
@ -125,7 +125,7 @@
expect([leftColor.sd_hexString isEqualToString:expectedColor.sd_hexString]);
}
#pragma mark - SDWebImageTransformer
#pragma mark - SDImageTransformer
- (void)test09ImagePipelineTransformer {
CGSize size = CGSizeMake(100, 100);
@ -140,10 +140,10 @@
#endif
CGFloat borderWidth = 1;
UIColor *borderCoder = [UIColor blackColor];
SDWebImageResizingTransformer *transformer1 = [SDWebImageResizingTransformer transformerWithSize:size scaleMode:scaleMode];
SDWebImageRotationTransformer *transformer2 = [SDWebImageRotationTransformer transformerWithAngle:angle fitSize:fitSize];
SDWebImageRoundCornerTransformer *transformer3 = [SDWebImageRoundCornerTransformer transformerWithRadius:radius corners:corners borderWidth:borderWidth borderColor:borderCoder];
SDWebImagePipelineTransformer *pipelineTransformer = [SDWebImagePipelineTransformer transformerWithTransformers:@[transformer1, transformer2, transformer3]];
SDImageResizingTransformer *transformer1 = [SDImageResizingTransformer transformerWithSize:size scaleMode:scaleMode];
SDImageRotationTransformer *transformer2 = [SDImageRotationTransformer transformerWithAngle:angle fitSize:fitSize];
SDImageRoundCornerTransformer *transformer3 = [SDImageRoundCornerTransformer transformerWithRadius:radius corners:corners borderWidth:borderWidth borderColor:borderCoder];
SDImagePipelineTransformer *pipelineTransformer = [SDImagePipelineTransformer transformerWithTransformers:@[transformer1, transformer2, transformer3]];
UIImage *transformedImage = [pipelineTransformer transformedImageWithImage:self.testImage forKey:@"Test"];
expect(CGSizeEqualToSize(transformedImage.size, size)).beTruthy();

View File

@ -7,9 +7,9 @@
* file that was distributed with this source code.
*/
#import <SDWebImage/SDWebImageTransformer.h>
#import <SDWebImage/SDImageTransformer.h>
@interface SDWebImageTestTransformer : NSObject <SDWebImageTransformer>
@interface SDWebImageTestTransformer : NSObject <SDImageTransformer>
@property (nonatomic, strong, nullable) UIImage *testImage;

View File

@ -47,7 +47,7 @@ FOUNDATION_EXPORT const unsigned char WebImageVersionString[];
#import <SDWebImage/SDWebImageDownloader.h>
#import <SDWebImage/SDWebImageTransition.h>
#import <SDWebImage/SDWebImageIndicator.h>
#import <SDWebImage/SDWebImageTransformer.h>
#import <SDWebImage/SDImageTransformer.h>
#import <SDWebImage/UIImage+Transform.h>
#import <SDWebImage/SDAnimatedImage.h>
#import <SDWebImage/SDAnimatedImageView.h>