Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a756e93fd | |||
| dd77c93277 | |||
| fa2fce9cb1 | |||
| 0deeafcf9d | |||
| dfe43e3e2b | |||
| d099161c69 | |||
| d0b3a1a252 | |||
| a157270270 | |||
| b659f9055d | |||
| eb13210dc3 | |||
| a62a9cdd48 | |||
| 8bec20644a | |||
| 84501d3495 |
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.2</string>
|
||||
<string>1.0.4</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
D9D41AE91BD1033700CD8EBF /* YYAnimatedImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = D9D41ACF1BD1033700CD8EBF /* YYAnimatedImageView.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D9D41AEA1BD1033700CD8EBF /* YYAnimatedImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = D9D41AD01BD1033700CD8EBF /* YYAnimatedImageView.m */; settings = {ASSET_TAGS = (); }; };
|
||||
D9D41AEA1BD1033700CD8EBF /* YYAnimatedImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = D9D41AD01BD1033700CD8EBF /* YYAnimatedImageView.m */; };
|
||||
D9D41AEB1BD1033700CD8EBF /* YYFrameImage.h in Headers */ = {isa = PBXBuildFile; fileRef = D9D41AD11BD1033700CD8EBF /* YYFrameImage.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D9D41AEC1BD1033700CD8EBF /* YYFrameImage.m in Sources */ = {isa = PBXBuildFile; fileRef = D9D41AD21BD1033700CD8EBF /* YYFrameImage.m */; settings = {ASSET_TAGS = (); }; };
|
||||
D9D41AEC1BD1033700CD8EBF /* YYFrameImage.m in Sources */ = {isa = PBXBuildFile; fileRef = D9D41AD21BD1033700CD8EBF /* YYFrameImage.m */; };
|
||||
D9D41AED1BD1033700CD8EBF /* YYImage.h in Headers */ = {isa = PBXBuildFile; fileRef = D9D41AD31BD1033700CD8EBF /* YYImage.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D9D41AEE1BD1033700CD8EBF /* YYImage.m in Sources */ = {isa = PBXBuildFile; fileRef = D9D41AD41BD1033700CD8EBF /* YYImage.m */; settings = {ASSET_TAGS = (); }; };
|
||||
D9D41AEE1BD1033700CD8EBF /* YYImage.m in Sources */ = {isa = PBXBuildFile; fileRef = D9D41AD41BD1033700CD8EBF /* YYImage.m */; };
|
||||
D9D41AF11BD1033700CD8EBF /* YYImageCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = D9D41AD71BD1033700CD8EBF /* YYImageCoder.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D9D41AF21BD1033700CD8EBF /* YYImageCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = D9D41AD81BD1033700CD8EBF /* YYImageCoder.m */; settings = {ASSET_TAGS = (); }; };
|
||||
D9D41AF21BD1033700CD8EBF /* YYImageCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = D9D41AD81BD1033700CD8EBF /* YYImageCoder.m */; };
|
||||
D9D41AF31BD1033700CD8EBF /* YYSpriteSheetImage.h in Headers */ = {isa = PBXBuildFile; fileRef = D9D41AD91BD1033700CD8EBF /* YYSpriteSheetImage.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D9D41AF41BD1033700CD8EBF /* YYSpriteSheetImage.m in Sources */ = {isa = PBXBuildFile; fileRef = D9D41ADA1BD1033700CD8EBF /* YYSpriteSheetImage.m */; settings = {ASSET_TAGS = (); }; };
|
||||
D9D41AF41BD1033700CD8EBF /* YYSpriteSheetImage.m in Sources */ = {isa = PBXBuildFile; fileRef = D9D41ADA1BD1033700CD8EBF /* YYSpriteSheetImage.m */; };
|
||||
D9D41AFB1BD10CE700CD8EBF /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D9D41AFA1BD10CE700CD8EBF /* UIKit.framework */; };
|
||||
D9D41AFD1BD10CEC00CD8EBF /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D9D41AFC1BD10CEC00CD8EBF /* CoreFoundation.framework */; };
|
||||
D9D41AFF1BD10CF200CD8EBF /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D9D41AFE1BD10CF200CD8EBF /* QuartzCore.framework */; };
|
||||
@@ -162,7 +162,7 @@
|
||||
D9D41AAD1BD102F300CD8EBF /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0700;
|
||||
LastUpgradeCheck = 0800;
|
||||
ORGANIZATIONNAME = ibireme;
|
||||
TargetAttributes = {
|
||||
D9D41AB51BD102F300CD8EBF = {
|
||||
@@ -226,8 +226,10 @@
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
@@ -250,7 +252,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -273,8 +275,10 @@
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
@@ -291,7 +295,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
@@ -304,6 +308,7 @@
|
||||
D9D41ABF1BD102F300CD8EBF /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
@@ -321,6 +326,7 @@
|
||||
D9D41AC01BD102F300CD8EBF /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0700"
|
||||
LastUpgradeVersion = "0800"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -85,7 +85,7 @@ Usage
|
||||
###Image decoder
|
||||
|
||||
// Decode single frame:
|
||||
NSData *data = [NSData dataWithContentOfFile:@"/tmp/image.webp"];
|
||||
NSData *data = [NSData dataWithContentsOfFile:@"/tmp/image.webp"];
|
||||
YYImageDecoder *decoder = [YYImageDecoder decoderWithData:data scale:2.0];
|
||||
UIImage image = [decoder frameAtIndex:0 decodeForDisplay:YES].image;
|
||||
|
||||
@@ -136,7 +136,7 @@ Installation
|
||||
2. Add `pod 'YYImage'` to your Podfile.
|
||||
3. Run `pod install` or `pod update`.
|
||||
4. Import \<YYImage/YYImage.h\>.
|
||||
5. Notice: it doesn't include WebP subspec by default, if you want to support WebP format, you may add `pod 'YYImage/WebP'` to your Podfile. You may call `YYImageWebPAvailable()` to check whether the WebP subspec is installed correctly.
|
||||
5. Notice: it doesn't include WebP subspec by default, if you want to support WebP format, you may add `pod 'YYImage/WebP'` to your Podfile.
|
||||
|
||||
### Carthage
|
||||
|
||||
@@ -159,8 +159,17 @@ Installation
|
||||
* MobileCoreServices
|
||||
* libz
|
||||
4. Import `YYImage.h`.
|
||||
5. Notice: if you want to support WebP format, you may add `Vendor/WebP.framework`(static library) to your Xcode project. You may call `YYImageWebPAvailable()` to check whether the WebP library is installed correctly.
|
||||
5. Notice: if you want to support WebP format, you may add `Vendor/WebP.framework`(static library) to your Xcode project.
|
||||
|
||||
FAQ
|
||||
==============
|
||||
_Q: Why I can't display WebP image?_
|
||||
|
||||
A: Make sure you added the `WebP.framework` in your project. You may call `YYImageWebPAvailable()` to check whether the WebP subspec is installed correctly.
|
||||
|
||||
_Q: Why I can't play APNG animation?_
|
||||
|
||||
A: You should disable the `Compress PNG Files` and `Remove Text Metadata From PNG Files` in your project's build settings. Or you can rename your APNG file's extension name with `apng`.
|
||||
|
||||
Documentation
|
||||
==============
|
||||
@@ -168,6 +177,7 @@ Full API documentation is available on [CocoaDocs](http://cocoadocs.org/docsets/
|
||||
You can also install documentation locally using [appledoc](https://github.com/tomaz/appledoc).
|
||||
|
||||
|
||||
|
||||
Requirements
|
||||
==============
|
||||
This library requires `iOS 6.0+` and `Xcode 7.0+`.
|
||||
@@ -265,7 +275,7 @@ YYImage: 功能强大的 iOS 图像框架。<br/>
|
||||
###图片解码
|
||||
|
||||
// 解码单帧图片:
|
||||
NSData *data = [NSData dataWithContentOfFile:@"/tmp/image.webp"];
|
||||
NSData *data = [NSData dataWithContentsOfFile:@"/tmp/image.webp"];
|
||||
YYImageDecoder *decoder = [YYImageDecoder decoderWithData:data scale:2.0];
|
||||
UIImage image = [decoder frameAtIndex:0 decodeForDisplay:YES].image;
|
||||
|
||||
@@ -316,7 +326,7 @@ YYImage: 功能强大的 iOS 图像框架。<br/>
|
||||
2. 在 Podfile 中添加 `pod 'YYImage'`。
|
||||
3. 执行 `pod install` 或 `pod update`。
|
||||
4. 导入 \<YYImage/YYImage.h\>。
|
||||
5. 注意:pod 配置并没有包含 WebP 组件, 如果你需要支持 WebP,可以在 Podfile 中添加 `pod 'YYImage/WebP'`。你可以调用 `YYImageWebPAvailable()` 来检查一下 WebP 组件是否被正确安装。
|
||||
5. 注意:pod 配置并没有包含 WebP 组件, 如果你需要支持 WebP,可以在 Podfile 中添加 `pod 'YYImage/WebP'`。
|
||||
|
||||
### Carthage
|
||||
|
||||
@@ -339,7 +349,17 @@ YYImage: 功能强大的 iOS 图像框架。<br/>
|
||||
* MobileCoreServices
|
||||
* libz
|
||||
4. 导入 `YYImage.h`。
|
||||
5. 注意:如果你需要支持 WebP,可以将 `Vendor/WebP.framework`(静态库) 加入你的工程。你可以调用 `YYImageWebPAvailable()` 来检查一下 WebP 组件是否被正确安装。
|
||||
5. 注意:如果你需要支持 WebP,可以将 `Vendor/WebP.framework`(静态库) 加入你的工程。
|
||||
|
||||
常见问题
|
||||
==============
|
||||
_Q: 为什么我不能显示 WebP 图片?_
|
||||
|
||||
A: 确保 `WebP.framework` 已经被添加到你的工程内了。你可以调用 `YYImageWebPAvailable()` 来检查一下 WebP 组件是否被正确安装。
|
||||
|
||||
_Q: 为什么我不能播放 APNG 动画?_
|
||||
|
||||
A: 你应该禁用 Build Settings 中的 `Compress PNG Files` 和 `Remove Text Metadata From PNG Files`. 或者你也可以把 APNG 文件的扩展名改为`apng`.
|
||||
|
||||
文档
|
||||
==============
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'YYImage'
|
||||
s.summary = 'Image framework for iOS to display/encode/decode animated WebP, APNG, GIF, and more.'
|
||||
s.version = '1.0.2'
|
||||
s.version = '1.0.4'
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.authors = { 'ibireme' => 'ibireme@gmail.com' }
|
||||
s.social_media_url = 'http://blog.ibireme.com'
|
||||
|
||||
@@ -822,7 +822,7 @@ static BOOL YYCGImageDecodeToBitmapBufferWith32BitFormat(CGImageRef srcImage, vI
|
||||
} else {
|
||||
contextBitmapInfo |= alphaFirst ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaPremultipliedLast;
|
||||
}
|
||||
CGContextRef context = CGBitmapContextCreate(NULL, width, height, 8, 32, YYCGColorSpaceGetDeviceRGB(), contextBitmapInfo);
|
||||
CGContextRef context = CGBitmapContextCreate(NULL, width, height, 8, 0, YYCGColorSpaceGetDeviceRGB(), contextBitmapInfo);
|
||||
if (!context) goto fail;
|
||||
|
||||
CGContextDrawImage(context, CGRectMake(0, 0, width, height), srcImage); // decode and convert
|
||||
@@ -1406,7 +1406,7 @@ CGImageRef YYCGImageCreateWithWebPData(CFDataRef webpData,
|
||||
void *tmp = calloc(1, destLength);
|
||||
if (tmp) {
|
||||
vImage_Buffer src = {destBytes, canvasHeight, canvasWidth, bytesPerRow};
|
||||
vImage_Buffer dest = {destBytes, canvasHeight, canvasWidth, bytesPerRow};
|
||||
vImage_Buffer dest = {tmp, canvasHeight, canvasWidth, bytesPerRow};
|
||||
vImage_CGAffineTransform transform = {1, 0, 0, 1, iter.x_offset, -iter.y_offset};
|
||||
uint8_t backColor[4] = {0};
|
||||
vImageAffineWarpCG_ARGB8888(&src, &dest, NULL, &transform, backColor, kvImageBackgroundColorFill);
|
||||
@@ -2457,13 +2457,13 @@ CGImageRef YYCGImageCreateWithWebPData(CFDataRef webpData,
|
||||
} else if ([imageSrc isKindOfClass:[NSURL class]]) {
|
||||
CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)imageSrc, NULL);
|
||||
if (source) {
|
||||
CGImageDestinationAddImageFromSource(destination, source, i, (CFDictionaryRef)frameProperty);
|
||||
CGImageDestinationAddImageFromSource(destination, source, 0, (CFDictionaryRef)frameProperty);
|
||||
CFRelease(source);
|
||||
}
|
||||
} else if ([imageSrc isKindOfClass:[NSData class]]) {
|
||||
CGImageSourceRef source = CGImageSourceCreateWithData((CFDataRef)imageSrc, NULL);
|
||||
if (source) {
|
||||
CGImageDestinationAddImageFromSource(destination, source, i, (CFDictionaryRef)frameProperty);
|
||||
CGImageDestinationAddImageFromSource(destination, source, 0, (CFDictionaryRef)frameProperty);
|
||||
CFRelease(source);
|
||||
}
|
||||
}
|
||||
@@ -2630,7 +2630,7 @@ CGImageRef YYCGImageCreateWithWebPData(CFDataRef webpData,
|
||||
chunk_fcTL.sequence_number = apngSequenceIndex;
|
||||
chunk_fcTL.width = frame->header.width;
|
||||
chunk_fcTL.height = frame->header.height;
|
||||
yy_png_delay_to_fraction([(NSNumber *)_durations[0] doubleValue], &chunk_fcTL.delay_num, &chunk_fcTL.delay_den);
|
||||
yy_png_delay_to_fraction([(NSNumber *)_durations[i] doubleValue], &chunk_fcTL.delay_num, &chunk_fcTL.delay_den);
|
||||
chunk_fcTL.delay_num = chunk_fcTL.delay_num;
|
||||
chunk_fcTL.delay_den = chunk_fcTL.delay_den;
|
||||
chunk_fcTL.dispose_op = YY_PNG_DISPOSE_OP_BACKGROUND;
|
||||
@@ -2783,7 +2783,7 @@ CGImageRef YYCGImageCreateWithWebPData(CFDataRef webpData,
|
||||
}
|
||||
|
||||
- (BOOL)yy_isDecodedForDisplay {
|
||||
if (self.images.count > 1) return YES;
|
||||
if (self.images.count > 1 || [self isKindOfClass:[YYSpriteSheetImage class]]) return YES;
|
||||
NSNumber *num = objc_getAssociatedObject(self, @selector(yy_isDecodedForDisplay));
|
||||
return [num boolValue];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user