Merge pull request #2395 from dreampiggy/renaming_image_format
Rename `sd_UTTypeFromSDImageFormat` to `sd_UTTypeFromImageFormat`
This commit is contained in:
commit
fe2fede60f
|
@ -37,7 +37,7 @@ typedef NS_ENUM(NSInteger, SDImageFormat) {
|
||||||
* @param format Format as SDImageFormat
|
* @param format Format as SDImageFormat
|
||||||
* @return The UTType as CFStringRef
|
* @return The UTType as CFStringRef
|
||||||
*/
|
*/
|
||||||
+ (nonnull CFStringRef)sd_UTTypeFromSDImageFormat:(SDImageFormat)format CF_RETURNS_NOT_RETAINED;
|
+ (nonnull CFStringRef)sd_UTTypeFromImageFormat:(SDImageFormat)format CF_RETURNS_NOT_RETAINED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert UTTyppe to SDImageFormat
|
* Convert UTTyppe to SDImageFormat
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
return SDImageFormatUndefined;
|
return SDImageFormatUndefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (nonnull CFStringRef)sd_UTTypeFromSDImageFormat:(SDImageFormat)format {
|
+ (nonnull CFStringRef)sd_UTTypeFromImageFormat:(SDImageFormat)format {
|
||||||
CFStringRef UTType;
|
CFStringRef UTType;
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case SDImageFormatJPEG:
|
case SDImageFormatJPEG:
|
||||||
|
|
|
@ -188,7 +188,7 @@ const CFStringRef kCGImagePropertyAPNGUnclampedDelayTime = (__bridge CFStringRef
|
||||||
}
|
}
|
||||||
|
|
||||||
NSMutableData *imageData = [NSMutableData data];
|
NSMutableData *imageData = [NSMutableData data];
|
||||||
CFStringRef imageUTType = [NSData sd_UTTypeFromSDImageFormat:SDImageFormatPNG];
|
CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:SDImageFormatPNG];
|
||||||
NSArray<SDImageFrame *> *frames = [SDImageCoderHelper framesFromAnimatedImage:image];
|
NSArray<SDImageFrame *> *frames = [SDImageCoderHelper framesFromAnimatedImage:image];
|
||||||
|
|
||||||
// Create an image destination. APNG does not support EXIF image orientation
|
// Create an image destination. APNG does not support EXIF image orientation
|
||||||
|
@ -243,7 +243,7 @@ const CFStringRef kCGImagePropertyAPNGUnclampedDelayTime = (__bridge CFStringRef
|
||||||
- (instancetype)initIncrementalWithOptions:(nullable SDImageCoderOptions *)options {
|
- (instancetype)initIncrementalWithOptions:(nullable SDImageCoderOptions *)options {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
CFStringRef imageUTType = [NSData sd_UTTypeFromSDImageFormat:SDImageFormatPNG];
|
CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:SDImageFormatPNG];
|
||||||
_imageSource = CGImageSourceCreateIncremental((__bridge CFDictionaryRef)@{(__bridge NSString *)kCGImageSourceTypeIdentifierHint : (__bridge NSString *)imageUTType});
|
_imageSource = CGImageSourceCreateIncremental((__bridge CFDictionaryRef)@{(__bridge NSString *)kCGImageSourceTypeIdentifierHint : (__bridge NSString *)imageUTType});
|
||||||
CGFloat scale = 1;
|
CGFloat scale = 1;
|
||||||
if ([options valueForKey:SDImageCoderDecodeScaleFactor]) {
|
if ([options valueForKey:SDImageCoderDecodeScaleFactor]) {
|
||||||
|
|
|
@ -80,7 +80,7 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over
|
||||||
#else
|
#else
|
||||||
|
|
||||||
NSMutableData *imageData = [NSMutableData data];
|
NSMutableData *imageData = [NSMutableData data];
|
||||||
CFStringRef imageUTType = [NSData sd_UTTypeFromSDImageFormat:SDImageFormatGIF];
|
CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:SDImageFormatGIF];
|
||||||
// Create an image destination. GIF does not support EXIF image orientation
|
// Create an image destination. GIF does not support EXIF image orientation
|
||||||
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frameCount, NULL);
|
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frameCount, NULL);
|
||||||
if (!imageDestination) {
|
if (!imageDestination) {
|
||||||
|
|
|
@ -183,7 +183,7 @@
|
||||||
- (instancetype)initIncrementalWithOptions:(nullable SDImageCoderOptions *)options {
|
- (instancetype)initIncrementalWithOptions:(nullable SDImageCoderOptions *)options {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
CFStringRef imageUTType = [NSData sd_UTTypeFromSDImageFormat:SDImageFormatGIF];
|
CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:SDImageFormatGIF];
|
||||||
_imageSource = CGImageSourceCreateIncremental((__bridge CFDictionaryRef)@{(__bridge NSString *)kCGImageSourceTypeIdentifierHint : (__bridge NSString *)imageUTType});
|
_imageSource = CGImageSourceCreateIncremental((__bridge CFDictionaryRef)@{(__bridge NSString *)kCGImageSourceTypeIdentifierHint : (__bridge NSString *)imageUTType});
|
||||||
CGFloat scale = 1;
|
CGFloat scale = 1;
|
||||||
if ([options valueForKey:SDImageCoderDecodeScaleFactor]) {
|
if ([options valueForKey:SDImageCoderDecodeScaleFactor]) {
|
||||||
|
@ -271,7 +271,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
NSMutableData *imageData = [NSMutableData data];
|
NSMutableData *imageData = [NSMutableData data];
|
||||||
CFStringRef imageUTType = [NSData sd_UTTypeFromSDImageFormat:SDImageFormatGIF];
|
CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:SDImageFormatGIF];
|
||||||
NSArray<SDImageFrame *> *frames = [SDImageCoderHelper framesFromAnimatedImage:image];
|
NSArray<SDImageFrame *> *frames = [SDImageCoderHelper framesFromAnimatedImage:image];
|
||||||
|
|
||||||
// Create an image destination. GIF does not support EXIF image orientation
|
// Create an image destination. GIF does not support EXIF image orientation
|
||||||
|
|
|
@ -203,7 +203,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
NSMutableData *imageData = [NSMutableData data];
|
NSMutableData *imageData = [NSMutableData data];
|
||||||
CFStringRef imageUTType = [NSData sd_UTTypeFromSDImageFormat:format];
|
CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format];
|
||||||
|
|
||||||
// Create an image destination.
|
// Create an image destination.
|
||||||
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, 1, NULL);
|
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, 1, NULL);
|
||||||
|
@ -261,7 +261,7 @@
|
||||||
static dispatch_once_t onceToken;
|
static dispatch_once_t onceToken;
|
||||||
dispatch_once(&onceToken, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
NSMutableData *imageData = [NSMutableData data];
|
NSMutableData *imageData = [NSMutableData data];
|
||||||
CFStringRef imageUTType = [NSData sd_UTTypeFromSDImageFormat:SDImageFormatHEIC];
|
CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:SDImageFormatHEIC];
|
||||||
|
|
||||||
// Create an image destination.
|
// Create an image destination.
|
||||||
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, 1, NULL);
|
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, 1, NULL);
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
expect(format == SDImageFormatUndefined);
|
expect(format == SDImageFormatUndefined);
|
||||||
|
|
||||||
// Test invalid format
|
// Test invalid format
|
||||||
CFStringRef type = [NSData sd_UTTypeFromSDImageFormat:SDImageFormatUndefined];
|
CFStringRef type = [NSData sd_UTTypeFromImageFormat:SDImageFormatUndefined];
|
||||||
expect(CFStringCompare(kUTTypePNG, type, 0)).equal(kCFCompareEqualTo);
|
expect(CFStringCompare(kUTTypePNG, type, 0)).equal(kCFCompareEqualTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue