diff --git a/.gitignore b/.gitignore index 507c623c..19111e41 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -Pods/* +Pods +UserInterface.xcuserstate +xcuserdata/ +*.lock \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..881e74a6 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,88 @@ +# SVGAPlayer-iOS CHANGELOG (2020-11-10) + +## [2.5.6](https://github.com/svga/SVGAPlayer-iOS/tree/2.5.6)(2020-11-10) +### Bug Fixes +* Fix: play with range error. ([db92d48](https://github.com/yyued/SVGAPlayer-iOS/commit/db92d48)) + +## [2.5.5](https://github.com/svga/SVGAPlayer-iOS/tree/2.5.5)(2020-10-15) +### Bug Fixes +* Fix: Add semaphore lock to videoCache and weakCache. ([5b3e530](https://github.com/yyued/SVGAPlayer-iOS/commit/5b3e530)) + +## [2.5.4](https://github.com/yyued/SVGAPlayer-iOS/tree/2.5.0-release)(2020-05-28) +### Bug Fixes +* Fix: audio could not play. ([cd6cca8](https://github.com/yyued/SVGAPlayer-iOS/commit/cd6cca8)) + +## [2.5.0](https://github.com/yyued/SVGAPlayer-iOS/tree/2.5.0-release)(2019-10-15) + +### Features + +* Add Support for matte layer and dynamic matte bitmap. +* Add Support for audio step to frame & percentage. + +## [2.3.5](https://github.com/yyued/SVGAPlayer-iOS/compare/2.3.4...2.3.5) (2019-09-29) + +### Bug Fixes + +* Let clearsAfterStop defaults too YES. ([4932be5](https://github.com/yyued/SVGAPlayer-iOS/commit/4932be5)) +* Add support for audio play in stepToFrame. ([873f8e4](https://github.com/yyued/SVGAPlayer-iOS/commit/873f8e4)) +* Correct mp3 file match in proto image for iOS13. ([eb45964](https://github.com/yyued/SVGAPlayer-iOS/commit/eb45964)) +* Correct ZIP file match when parse for iOS13. ([f3e204f](https://github.com/yyued/SVGAPlayer-iOS/commit/f3e204f)) + +## [2.3.4](https://github.com/yyued/SVGAPlayer-iOS/compare/2.3.3...2.3.4) (2019-08-02) + +### Bug Fixes + +* Correct file tag des hit target. ([0018e13](https://github.com/yyued/SVGAPlayer-iOS/commit/0018e13)) +* Correct file tag des hit target. ([dc2e403](https://github.com/yyued/SVGAPlayer-iOS/commit/dc2e403)) +* Fix static layer. ([ab1d4fc](https://github.com/yyued/SVGAPlayer-iOS/commit/ab1d4fc)) +* Fix demo aspect scale. ([33ea6b3](https://github.com/yyued/SVGAPlayer-iOS/commit/33ea6b3)) +* Fix key for svga 1.x format. ([ec43259](https://github.com/yyued/SVGAPlayer-iOS/commit/ec43259)) +* Return when videoItem is nil in startAnimation. ([cb27f0f](https://github.com/yyued/SVGAPlayer-iOS/commit/cb27f0f)) + +### Features + +* Add 2.x proto support for matte. ([527e76f](https://github.com/yyued/SVGAPlayer-iOS/commit/527e76f)) +* Add slider for animation demo. ([fc9d7ef](https://github.com/yyued/SVGAPlayer-iOS/commit/fc9d7ef)) +* Support bitmap matte layer. ([4c4e2b1](https://github.com/yyued/SVGAPlayer-iOS/commit/4c4e2b1)) +* Support muti mask. ([188c1b3](https://github.com/yyued/SVGAPlayer-iOS/commit/188c1b3)) +* Update 2.x proto support for matte. ([2b28845](https://github.com/yyued/SVGAPlayer-iOS/commit/2b28845)) + +### Bug Fixes + +* Rollback SSZipArchive to 1.8.1 because of crash. ([2f9d94b](https://github.com/yyued/SVGAPlayer-iOS/commit/2f9d94b)) + +## [2.3.1](https://github.com/yyued/SVGAPlayer-iOS/compare/2.3.0...2.3.1) (2018-12-18) + +### Bug Fixes + +* Add enabledMemoryCache option to SVGAParser, disable memory cache to default. ([116a91f](https://github.com/yyued/SVGAPlayer-iOS/commit/116a91f)) + +## 2.3.0 + +### Features + +* Add audio support. + +## 2.1.4 + +### Bug Fixes + +* Add classtype asserts to avoid crash. + +## 2.1.3 + +* Add SVGAImageView and SVGAVideoEntity to SVGA.h; +* Add URLRequest params to SVGAParser; + +## 2.1.2 + +* Add dynamicHidden and dynamicDrawing. + +## 2.1.1 + +### Bug Fixes +* Use CADisplayLink::invalid() replace removeFromRunloop. +improve: all Parser callback will perform on Main Thread. + + + diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..56c05682 --- /dev/null +++ b/ISSUE_TEMPLATE.md @@ -0,0 +1,25 @@ +## Attention + +* Do not ask any usage question, issue board is a issue board, accept library bugs only. +* If you are facing any usage problem, read the README again. + +## Issue Template + +Issue Description(What's your problem) + +How To Reappear(How to reappear the issue) + +Any Attachment(Provide a sample about your issue) + +------ 中文分割线 ------ + +## 注意 + +* 不要在 Issue 板块提问使用问题,Issue 板块只接受 Bug 反馈。 +* 如果遇到使用上的问题,仔细阅读 README。 + +## Issue 模板 + +请尽量使用英文提交 Issue + +请确切回答:问题的描述、重现方式、附件(提供一个 Demo 以重现问题) diff --git a/Podfile b/Podfile index d54f6910..3cb9a7ae 100644 --- a/Podfile +++ b/Podfile @@ -2,27 +2,7 @@ platform :ios, '8.0' target 'SVGAPlayer' do - pod 'SSZipArchive', '~> 1.8.1' + pod 'SSZipArchive', '~> 2.1.4' pod 'Protobuf', '~> 3.4' end - -target 'SVGAPlayer React' do - - pod 'SSZipArchive', '~> 1.8.1' - pod 'React', :podspec => 'https://raw.githubusercontent.com/yyued/react-native-runtime-ios/0.45.1/React.podspec', :subspecs => [ - 'Core', - 'ART', - 'RCTActionSheet', - 'RCTGeolocation', - 'RCTImage', - 'RCTNetwork', - 'RCTSettings', - 'RCTText', - 'RCTVibration', - 'RCTWebSocket', - 'RCTLinkingIOS', - ] - pod 'Yoga' - -end diff --git a/Podfile.lock b/Podfile.lock index 7ebd505a..be536f16 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,61 +1,20 @@ PODS: - - Protobuf (3.4.0) - - React/ART (0.45.1): - - React/Core - - React/Core (0.45.1): - - React/cxxreact - - Yoga - - React/cxxreact (0.45.1): - - React/jschelpers - - React/jschelpers (0.45.1) - - React/RCTActionSheet (0.45.1): - - React/Core - - React/RCTGeolocation (0.45.1): - - React/Core - - React/RCTImage (0.45.1): - - React/Core - - React/RCTNetwork - - React/RCTLinkingIOS (0.45.1): - - React/Core - - React/RCTNetwork (0.45.1): - - React/Core - - React/RCTSettings (0.45.1): - - React/Core - - React/RCTText (0.45.1): - - React/Core - - React/RCTVibration (0.45.1): - - React/Core - - React/RCTWebSocket (0.45.1): - - React/Core - - SSZipArchive (1.8.1) - - Yoga (1.6.0) + - Protobuf (3.6.1) + - SSZipArchive (2.1.4) DEPENDENCIES: - Protobuf (~> 3.4) - - React/ART (from `https://raw.githubusercontent.com/yyued/react-native-runtime-ios/0.45.1/React.podspec`) - - React/Core (from `https://raw.githubusercontent.com/yyued/react-native-runtime-ios/0.45.1/React.podspec`) - - React/RCTActionSheet (from `https://raw.githubusercontent.com/yyued/react-native-runtime-ios/0.45.1/React.podspec`) - - React/RCTGeolocation (from `https://raw.githubusercontent.com/yyued/react-native-runtime-ios/0.45.1/React.podspec`) - - React/RCTImage (from `https://raw.githubusercontent.com/yyued/react-native-runtime-ios/0.45.1/React.podspec`) - - React/RCTLinkingIOS (from `https://raw.githubusercontent.com/yyued/react-native-runtime-ios/0.45.1/React.podspec`) - - React/RCTNetwork (from `https://raw.githubusercontent.com/yyued/react-native-runtime-ios/0.45.1/React.podspec`) - - React/RCTSettings (from `https://raw.githubusercontent.com/yyued/react-native-runtime-ios/0.45.1/React.podspec`) - - React/RCTText (from `https://raw.githubusercontent.com/yyued/react-native-runtime-ios/0.45.1/React.podspec`) - - React/RCTVibration (from `https://raw.githubusercontent.com/yyued/react-native-runtime-ios/0.45.1/React.podspec`) - - React/RCTWebSocket (from `https://raw.githubusercontent.com/yyued/react-native-runtime-ios/0.45.1/React.podspec`) - - SSZipArchive (~> 1.8.1) - - Yoga + - SSZipArchive (~> 2.1.4) -EXTERNAL SOURCES: - React: - :podspec: https://raw.githubusercontent.com/yyued/react-native-runtime-ios/0.45.1/React.podspec +SPEC REPOS: + https://github.com/CocoaPods/Specs.git: + - Protobuf + - SSZipArchive SPEC CHECKSUMS: - Protobuf: 03eef2ee0b674770735cf79d9c4d3659cf6908e8 - React: 505e0132cd9aaba1a56e47ef509220dd794ec9be - SSZipArchive: 04547dfa448be5ed7ecbaf7eaf8a6e9eb9b42997 - Yoga: 81670877477311136b1b3f69a6307ce62e1c89cf + Protobuf: 1eb9700044745f00181c136ef21b8ff3ad5a0fd5 + SSZipArchive: 41455d4b8d2b6ab93990820b50dc697c2554a322 -PODFILE CHECKSUM: b7d71960f4fe0b08fd7d4651b412bb8bec6c19f2 +PODFILE CHECKSUM: 15ec3c806396baa34a298b2254638f0a6691580c -COCOAPODS: 1.3.1 +COCOAPODS: 1.9.1 diff --git a/React/SVGAPlayerManager.h b/React/SVGAPlayerManager.h deleted file mode 100644 index 1b12aa5d..00000000 --- a/React/SVGAPlayerManager.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// SVGAPlayerManager.h -// SVGAPlayer -// -// Created by 崔明辉 on 2017/6/15. -// Copyright © 2017年 UED Center. All rights reserved. -// - -#import -#import - -@interface SVGAPlayerManager : RCTViewManager - -@end diff --git a/React/SVGAPlayerManager.m b/React/SVGAPlayerManager.m deleted file mode 100644 index a2b6fa38..00000000 --- a/React/SVGAPlayerManager.m +++ /dev/null @@ -1,182 +0,0 @@ -// -// SVGAPlayerManager.m -// SVGAPlayer -// -// Created by 崔明辉 on 2017/6/15. -// Copyright © 2017年 UED Center. All rights reserved. -// - -#import "SVGAPlayerManager.h" -#import "SVGAPlayer.h" -#import "SVGAParser.h" -#import - -@interface SVGAPlayer (React) - -@property(nonatomic, copy) NSString *source; -@property(nonatomic, copy) NSString *currentState; -@property(nonatomic, assign) NSInteger toFrame; -@property(nonatomic, assign) NSInteger toPercentage; -@property(nonatomic, copy) RCTBubblingEventBlock onFinished; -@property(nonatomic, copy) RCTBubblingEventBlock onFrame; -@property(nonatomic, copy) RCTBubblingEventBlock onPercentage; - -@end - -@implementation SVGAPlayer (React) - -static int kReactSourceIdentifier; -static int kReactCurrentStateIdentifier; -static int kReactOnFinishedIdentifier; -static int kReactOnFrameIdentifier; -static int kReactOnPercentageIdentifier; - -- (void)loadWithSource:(NSString *)source { - SVGAParser *parser = [[SVGAParser alloc] init]; - if ([source hasPrefix:@"http"] || [source hasPrefix:@"https"]) { - [parser parseWithURL:[NSURL URLWithString:source] - completionBlock:^(SVGAVideoEntity *_Nullable videoItem) { - [[NSOperationQueue mainQueue] addOperationWithBlock:^{ - [self setVideoItem:videoItem]; - [self startAnimation]; - }]; - } - failureBlock:nil]; - } else { - NSString *localPath = [[NSBundle mainBundle] pathForResource:source ofType:@"svga"]; - if (localPath != nil) { - [parser parseWithData:[NSData dataWithContentsOfFile:localPath] - cacheKey:source - completionBlock:^(SVGAVideoEntity *_Nonnull videoItem) { - [[NSOperationQueue mainQueue] addOperationWithBlock:^{ - [self setVideoItem:videoItem]; - [self startAnimation]; - }]; - } - failureBlock:nil]; - } - } -} - -- (void)setSource:(NSString *)source { - if ([source isKindOfClass:[NSString class]] && ([self source] == nil || ![source isEqualToString:[self source]])) { - objc_setAssociatedObject(self, &kReactSourceIdentifier, source, OBJC_ASSOCIATION_COPY_NONATOMIC); - [self loadWithSource:source]; - } -} - -- (NSString *)source { - return objc_getAssociatedObject(self, &kReactSourceIdentifier); -} - -- (void)setCurrentState:(NSString *)currentState { - if ([currentState isKindOfClass:[NSString class]] && - ([self currentState] == nil || ![currentState isEqualToString:[self currentState]])) { - objc_setAssociatedObject(self, &kReactCurrentStateIdentifier, currentState, OBJC_ASSOCIATION_COPY_NONATOMIC); - if ([currentState isEqualToString:@"start"]) { - [self startAnimation]; - } else if ([currentState isEqualToString:@"pause"]) { - [self pauseAnimation]; - } else if ([currentState isEqualToString:@"stop"]) { - [self stopAnimation]; - } else if ([currentState isEqualToString:@"clear"]) { - [self stopAnimation]; - [self clear]; - } - } -} - -- (NSString *)currentState { - return objc_getAssociatedObject(self, &kReactCurrentStateIdentifier); -} - -- (void)setOnFinished:(RCTBubblingEventBlock)onFinished { - objc_setAssociatedObject(self, &kReactOnFinishedIdentifier, onFinished, OBJC_ASSOCIATION_COPY_NONATOMIC); -} - -- (RCTBubblingEventBlock)onFinished { - return objc_getAssociatedObject(self, &kReactOnFinishedIdentifier); -} - -- (void)setOnFrame:(RCTBubblingEventBlock)onFrame { - objc_setAssociatedObject(self, &kReactOnFrameIdentifier, onFrame, OBJC_ASSOCIATION_COPY_NONATOMIC); -} - -- (RCTBubblingEventBlock)onFrame { - return objc_getAssociatedObject(self, &kReactOnFrameIdentifier); -} - -- (void)setOnPercentage:(RCTBubblingEventBlock)onPercentage { - objc_setAssociatedObject(self, &kReactOnPercentageIdentifier, onPercentage, OBJC_ASSOCIATION_COPY_NONATOMIC); -} - -- (RCTBubblingEventBlock)onPercentage { - return objc_getAssociatedObject(self, &kReactOnPercentageIdentifier); -} - -- (void)setToFrame:(NSInteger)toFrame { - if (toFrame < 0) { - return; - } - [self stepToFrame:toFrame andPlay:[self.currentState isEqualToString:@"play"]]; -} - -- (NSInteger)toFrame { - return 0; -} - -- (void)setToPercentage:(NSInteger)toPercentage { - if (toPercentage < 0) { - return; - } - [self stepToPercentage:toPercentage andPlay:[self.currentState isEqualToString:@"play"]]; -} - -- (NSInteger)toPercentage { - return 0.0; -} - -- (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player { - if (self.onFinished) { - self.onFinished(@{}); - } -} - -- (void)svgaPlayerDidAnimatedToFrame:(NSInteger)frame { - if (self.onFrame) { - self.onFrame(@{ @"value" : @(frame) }); - } -} - -- (void)svgaPlayerDidAnimatedToPercentage:(CGFloat)percentage { - if (self.onPercentage) { - self.onPercentage(@{ @"value" : @(percentage) }); - } -} - -@end - -@interface SVGAPlayerManager () - -@end - -@implementation SVGAPlayerManager - -RCT_EXPORT_MODULE() -RCT_EXPORT_VIEW_PROPERTY(loops, NSInteger) -RCT_EXPORT_VIEW_PROPERTY(clearsAfterStop, BOOL) -RCT_EXPORT_VIEW_PROPERTY(source, NSString) -RCT_EXPORT_VIEW_PROPERTY(currentState, NSString) -RCT_EXPORT_VIEW_PROPERTY(toFrame, NSInteger) -RCT_EXPORT_VIEW_PROPERTY(toPercentage, NSInteger) -RCT_EXPORT_VIEW_PROPERTY(onFinished, RCTBubblingEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onFrame, RCTBubblingEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onPercentage, RCTBubblingEventBlock) - -- (UIView *)view { - SVGAPlayer *aPlayer = [[SVGAPlayer alloc] init]; - aPlayer.delegate = aPlayer; - return aPlayer; -} - -@end diff --git a/SVGAPlayer-React.podspec b/SVGAPlayer-React.podspec deleted file mode 100644 index 2dba8972..00000000 --- a/SVGAPlayer-React.podspec +++ /dev/null @@ -1,31 +0,0 @@ - -Pod::Spec.new do |s| - s.name = "SVGAPlayer" - s.version = "2.1.0" - s.summary = "SVGAPlayer 是一个高性能的动画播放器" - s.description = <<-DESC - SVGA 是一个私有的动画格式,由 YY UED 主导开发。 - SVGA 由 SVG 演进而成,与 SVG 不兼容。 - SVGA 可以在 iOS / Android / Web(PC/移动端) 实现高性能的动画播放。 - DESC - s.homepage = "http://code.yy.com/ued/SVGAPlayer" - s.license = "Private" - s.author = { "PonyCui" => "cuiminghui1@yy.com" } - s.platform = :ios, "7.0" - s.source = { :git => "https://github.com/yyued/SVGAPlayer-iOS.git", :tag => s.version } - s.subspec 'Core' do |ss| - ss.source_files = "Source/*.{h,m}", "React/*.{h,m}" - ss.requires_arc = true - ss.dependency 'SSZipArchive', '1.8.1' - ss.library = "z" - ss.dependency 'SVGAPlayer/ProtoFiles' - end - s.subspec 'ProtoFiles' do |ss| - ss.source_files = "Source/pbobjc/*.{h,m}" - ss.requires_arc = false - ss.dependency 'Protobuf', '~> 3.4' - ss.pod_target_xcconfig = { - 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1', - } - end -end \ No newline at end of file diff --git a/SVGAPlayer.podspec b/SVGAPlayer.podspec index defe2f7b..3753c367 100644 --- a/SVGAPlayer.podspec +++ b/SVGAPlayer.podspec @@ -1,24 +1,25 @@ Pod::Spec.new do |s| s.name = "SVGAPlayer" - s.version = "2.1.0" + s.version = "2.5.7" s.summary = "SVGAPlayer 是一个高性能的动画播放器" s.description = <<-DESC - SVGA 是一个私有的动画格式,由 YY UED 主导开发。 - SVGA 由 SVG 演进而成,与 SVG 不兼容。 - SVGA 可以在 iOS / Android / Web(PC/移动端) 实现高性能的动画播放。 + SVGA 是一种全新的动画格式,由 YY UED 团队主导开发; + SVGA 让动画开发分工明确,大大减少动画交互的沟通成本,提升开发效率; + SVGA 可以在 iOS / Android / Web / Flutter 实现高性能的动画播放。 DESC s.homepage = "http://code.yy.com/ued/SVGAPlayer" s.license = "Apache 2.0" s.author = { "PonyCui" => "cuiminghui1@yy.com" } s.platform = :ios, "7.0" - s.source = { :git => "https://github.com/yyued/SVGAPlayer-iOS.git", :tag => s.version } + s.source = { :git => "https://github.com/svga/SVGAPlayer-iOS.git", :tag => s.version } s.subspec 'Core' do |ss| ss.source_files = "Source/*.{h,m}" ss.requires_arc = true - ss.dependency 'SSZipArchive', '1.8.1' + ss.dependency 'SSZipArchive', '>= 1.8.1' ss.library = "z" + ss.framework = "AVFoundation" ss.dependency 'SVGAPlayer/ProtoFiles' end s.subspec 'ProtoFiles' do |ss| @@ -29,4 +30,4 @@ Pod::Spec.new do |s| 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1', } end -end \ No newline at end of file +end diff --git a/SVGAPlayer.xcodeproj/project.pbxproj b/SVGAPlayer.xcodeproj/project.pbxproj index e68744f5..4f39f57f 100644 --- a/SVGAPlayer.xcodeproj/project.pbxproj +++ b/SVGAPlayer.xcodeproj/project.pbxproj @@ -7,7 +7,14 @@ objects = { /* Begin PBXBuildFile section */ - 4B62B1C5E6CE2BE2D914927B /* libPods-SVGAPlayer React.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 92332F7A897BF4379D765B05 /* libPods-SVGAPlayer React.a */; }; + 63712E6521787950001AE014 /* heartbeat.svga in Resources */ = {isa = PBXBuildFile; fileRef = 63712E6421787950001AE014 /* heartbeat.svga */; }; + 63712E6821787A45001AE014 /* SVGAAudioEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = 63712E6721787A45001AE014 /* SVGAAudioEntity.m */; }; + 63E817012178809D001D2D62 /* SVGAAudioLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E817002178809D001D2D62 /* SVGAAudioLayer.m */; }; + 71418C93225E6F710029C69E /* mutiMatte.svga in Resources */ = {isa = PBXBuildFile; fileRef = 71418C92225E6F710029C69E /* mutiMatte.svga */; }; + 718A146D235718E000FED5D3 /* Rocket.svga in Resources */ = {isa = PBXBuildFile; fileRef = 718A146C235718E000FED5D3 /* Rocket.svga */; }; + 71A8679122B7785100176CD6 /* matteRect.svga in Resources */ = {isa = PBXBuildFile; fileRef = 71A8679022B7785100176CD6 /* matteRect.svga */; }; + 71A8679322B7853600176CD6 /* matteBitmap.svga in Resources */ = {isa = PBXBuildFile; fileRef = 71A8679222B7853600176CD6 /* matteBitmap.svga */; }; + 71DAA8A52355B3ED006608A1 /* Goddess.svga in Resources */ = {isa = PBXBuildFile; fileRef = 71DAA8A42355B3ED006608A1 /* Goddess.svga */; }; 80D4C7254846B96B9C6EED83 /* libPods-SVGAPlayer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DDA5FF396660C7C932DF9B8 /* libPods-SVGAPlayer.a */; }; 904D41F81D223DD20085A21A /* SVGABezierPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 904D41F71D223DD20085A21A /* SVGABezierPath.m */; }; 9052FC631E6EB8D4007BC925 /* SVGAExporter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9052FC621E6EB8D4007BC925 /* SVGAExporter.m */; }; @@ -26,35 +33,27 @@ 90A676FD1D13A82A008A69F3 /* SVGAParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 90A676FC1D13A82A008A69F3 /* SVGAParser.m */; }; 90A677031D13AE19008A69F3 /* SVGAVideoEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = 90A677021D13AE19008A69F3 /* SVGAVideoEntity.m */; }; 90A677061D13BF77008A69F3 /* SVGAPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 90A677051D13BF77008A69F3 /* SVGAPlayer.m */; }; - 90CB64CC1EF290F400DAA382 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 90A676E71D13A6DF008A69F3 /* ViewController.m */; }; - 90CB64CD1EF290F400DAA382 /* SVGAExporter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9052FC621E6EB8D4007BC925 /* SVGAExporter.m */; }; - 90CB64CE1EF290F400DAA382 /* SVGAVideoEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = 90A677021D13AE19008A69F3 /* SVGAVideoEntity.m */; }; - 90CB64CF1EF290F400DAA382 /* SVGAVideoSpriteFrameEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = 90A364D91E5AED04009347F1 /* SVGAVideoSpriteFrameEntity.m */; }; - 90CB64D01EF290F400DAA382 /* SVGABitmapLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 90A364D01E5AEC11009347F1 /* SVGABitmapLayer.m */; }; - 90CB64D11EF290F400DAA382 /* SVGABezierPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 904D41F71D223DD20085A21A /* SVGABezierPath.m */; }; - 90CB64D21EF290F400DAA382 /* SVGAVideoSpriteEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = 90A364D61E5AECBD009347F1 /* SVGAVideoSpriteEntity.m */; }; - 90CB64D31EF290F400DAA382 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 90A676E41D13A6DF008A69F3 /* AppDelegate.m */; }; - 90CB64D41EF290F400DAA382 /* SVGAContentLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 90A364DC1E5D33F8009347F1 /* SVGAContentLayer.m */; }; - 90CB64D51EF290F400DAA382 /* SVGA.m in Sources */ = {isa = PBXBuildFile; fileRef = 90A676F91D13A81F008A69F3 /* SVGA.m */; }; - 90CB64D61EF290F400DAA382 /* SVGAPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 90A677051D13BF77008A69F3 /* SVGAPlayer.m */; }; - 90CB64D71EF290F400DAA382 /* SVGAVectorLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 90A364D31E5AEC1C009347F1 /* SVGAVectorLayer.m */; }; - 90CB64D81EF290F400DAA382 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 90A676E11D13A6DF008A69F3 /* main.m */; }; - 90CB64D91EF290F400DAA382 /* SVGAParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 90A676FC1D13A82A008A69F3 /* SVGAParser.m */; }; - 90CB64DD1EF290F400DAA382 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 90A676EE1D13A6DF008A69F3 /* LaunchScreen.storyboard */; }; - 90CB64DE1EF290F400DAA382 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 90A676EC1D13A6DF008A69F3 /* Assets.xcassets */; }; - 90CB64DF1EF290F400DAA382 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 90A676E91D13A6DF008A69F3 /* Main.storyboard */; }; - 90CB64F71EF2925000DAA382 /* SVGAPlayerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 90CB64F61EF2925000DAA382 /* SVGAPlayerManager.m */; }; 90CB64F91EF297E800DAA382 /* SVGAPlayer React-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 90CB64F81EF297E800DAA382 /* SVGAPlayer React-Info.plist */; }; 90D7CA161F7FA07A006E74F0 /* Svga.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = 90D7CA141F7FA079006E74F0 /* Svga.pbobjc.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 90D7CA1B1F7FB114006E74F0 /* rose_2.0.0.svga in Resources */ = {isa = PBXBuildFile; fileRef = 90D7CA191F7FB114006E74F0 /* rose_2.0.0.svga */; }; 90D7CA1C1F7FB114006E74F0 /* rose_1.5.0.svga in Resources */ = {isa = PBXBuildFile; fileRef = 90D7CA1A1F7FB114006E74F0 /* rose_1.5.0.svga */; }; 90D7CA1E1F7FB34E006E74F0 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 90D7CA1D1F7FB34E006E74F0 /* libz.tbd */; }; 90DB59B51F96026E00894727 /* SVGAImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 90DB59B41F96026E00894727 /* SVGAImageView.m */; }; + E83A58D9247E0E6A00D9F404 /* audio_biling.svga in Resources */ = {isa = PBXBuildFile; fileRef = E83A58D8247E0E6A00D9F404 /* audio_biling.svga */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 1DDA5FF396660C7C932DF9B8 /* libPods-SVGAPlayer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SVGAPlayer.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2EF4851C027B3C0E45E3C5C0 /* Pods-SVGAPlayer React.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SVGAPlayer React.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SVGAPlayer React/Pods-SVGAPlayer React.debug.xcconfig"; sourceTree = ""; }; + 63712E6421787950001AE014 /* heartbeat.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = heartbeat.svga; sourceTree = ""; }; + 63712E6621787A45001AE014 /* SVGAAudioEntity.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAAudioEntity.h; sourceTree = ""; }; + 63712E6721787A45001AE014 /* SVGAAudioEntity.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SVGAAudioEntity.m; sourceTree = ""; }; + 63E816FF2178809D001D2D62 /* SVGAAudioLayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAAudioLayer.h; sourceTree = ""; }; + 63E817002178809D001D2D62 /* SVGAAudioLayer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SVGAAudioLayer.m; sourceTree = ""; }; + 71418C92225E6F710029C69E /* mutiMatte.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = mutiMatte.svga; sourceTree = ""; }; + 718A146C235718E000FED5D3 /* Rocket.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = Rocket.svga; sourceTree = ""; }; + 71A8679022B7785100176CD6 /* matteRect.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = matteRect.svga; sourceTree = ""; }; + 71A8679222B7853600176CD6 /* matteBitmap.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = matteBitmap.svga; sourceTree = ""; }; + 71DAA8A42355B3ED006608A1 /* Goddess.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = Goddess.svga; sourceTree = ""; }; 8AD65028FA2D122A34DC4A63 /* Pods-SVGAPlayer.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SVGAPlayer.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SVGAPlayer/Pods-SVGAPlayer.debug.xcconfig"; sourceTree = ""; }; 904D41F61D223DD20085A21A /* SVGABezierPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGABezierPath.h; sourceTree = ""; }; 904D41F71D223DD20085A21A /* SVGABezierPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGABezierPath.m; sourceTree = ""; }; @@ -88,9 +87,6 @@ 90A677021D13AE19008A69F3 /* SVGAVideoEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGAVideoEntity.m; sourceTree = ""; }; 90A677041D13BF77008A69F3 /* SVGAPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAPlayer.h; sourceTree = ""; }; 90A677051D13BF77008A69F3 /* SVGAPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGAPlayer.m; sourceTree = ""; }; - 90CB64E51EF290F400DAA382 /* SVGAPlayer React.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "SVGAPlayer React.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 90CB64F51EF2925000DAA382 /* SVGAPlayerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAPlayerManager.h; sourceTree = ""; }; - 90CB64F61EF2925000DAA382 /* SVGAPlayerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGAPlayerManager.m; sourceTree = ""; }; 90CB64F81EF297E800DAA382 /* SVGAPlayer React-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "SVGAPlayer React-Info.plist"; sourceTree = ""; }; 90D7CA141F7FA079006E74F0 /* Svga.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Svga.pbobjc.m; sourceTree = ""; }; 90D7CA151F7FA079006E74F0 /* Svga.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Svga.pbobjc.h; sourceTree = ""; }; @@ -99,9 +95,8 @@ 90D7CA1D1F7FB34E006E74F0 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; 90DB59B31F96026E00894727 /* SVGAImageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAImageView.h; sourceTree = ""; }; 90DB59B41F96026E00894727 /* SVGAImageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SVGAImageView.m; sourceTree = ""; }; - 92332F7A897BF4379D765B05 /* libPods-SVGAPlayer React.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SVGAPlayer React.a"; sourceTree = BUILT_PRODUCTS_DIR; }; E02B8713B25C0283C736EE03 /* Pods-SVGAPlayer.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SVGAPlayer.release.xcconfig"; path = "Pods/Target Support Files/Pods-SVGAPlayer/Pods-SVGAPlayer.release.xcconfig"; sourceTree = ""; }; - FF89C40C3E9839DA5DE71191 /* Pods-SVGAPlayer React.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SVGAPlayer React.release.xcconfig"; path = "Pods/Target Support Files/Pods-SVGAPlayer React/Pods-SVGAPlayer React.release.xcconfig"; sourceTree = ""; }; + E83A58D8247E0E6A00D9F404 /* audio_biling.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = audio_biling.svga; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -114,14 +109,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 90CB64DA1EF290F400DAA382 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 4B62B1C5E6CE2BE2D914927B /* libPods-SVGAPlayer React.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -130,8 +117,6 @@ children = ( 8AD65028FA2D122A34DC4A63 /* Pods-SVGAPlayer.debug.xcconfig */, E02B8713B25C0283C736EE03 /* Pods-SVGAPlayer.release.xcconfig */, - 2EF4851C027B3C0E45E3C5C0 /* Pods-SVGAPlayer React.debug.xcconfig */, - FF89C40C3E9839DA5DE71191 /* Pods-SVGAPlayer React.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -139,7 +124,6 @@ 90A676D41D13A6DF008A69F3 = { isa = PBXGroup; children = ( - 90CB64C81EF290E600DAA382 /* React */, 90A676F71D13A70E008A69F3 /* Source */, 90A676DF1D13A6DF008A69F3 /* SVGAPlayer */, 90A676DE1D13A6DF008A69F3 /* Products */, @@ -152,7 +136,6 @@ isa = PBXGroup; children = ( 90A676DD1D13A6DF008A69F3 /* SVGAPlayer.app */, - 90CB64E51EF290F400DAA382 /* SVGAPlayer React.app */, ); name = Products; sourceTree = ""; @@ -193,6 +176,8 @@ 90A676FC1D13A82A008A69F3 /* SVGAParser.m */, 90A677011D13AE19008A69F3 /* SVGAVideoEntity.h */, 90A677021D13AE19008A69F3 /* SVGAVideoEntity.m */, + 63712E6621787A45001AE014 /* SVGAAudioEntity.h */, + 63712E6721787A45001AE014 /* SVGAAudioEntity.m */, 90A364D51E5AECBD009347F1 /* SVGAVideoSpriteEntity.h */, 90A364D61E5AECBD009347F1 /* SVGAVideoSpriteEntity.m */, 90A364D81E5AED04009347F1 /* SVGAVideoSpriteFrameEntity.h */, @@ -203,6 +188,8 @@ 90A364D01E5AEC11009347F1 /* SVGABitmapLayer.m */, 90A364D21E5AEC1B009347F1 /* SVGAVectorLayer.h */, 90A364D31E5AEC1C009347F1 /* SVGAVectorLayer.m */, + 63E816FF2178809D001D2D62 /* SVGAAudioLayer.h */, + 63E817002178809D001D2D62 /* SVGAAudioLayer.m */, 90A677041D13BF77008A69F3 /* SVGAPlayer.h */, 90A677051D13BF77008A69F3 /* SVGAPlayer.m */, 90DB59B31F96026E00894727 /* SVGAImageView.h */, @@ -215,18 +202,16 @@ path = Source; sourceTree = ""; }; - 90CB64C81EF290E600DAA382 /* React */ = { - isa = PBXGroup; - children = ( - 90CB64F51EF2925000DAA382 /* SVGAPlayerManager.h */, - 90CB64F61EF2925000DAA382 /* SVGAPlayerManager.m */, - ); - path = React; - sourceTree = ""; - }; 90D7C9FA1F7E2AA3006E74F0 /* Samples */ = { isa = PBXGroup; children = ( + E83A58D8247E0E6A00D9F404 /* audio_biling.svga */, + 718A146C235718E000FED5D3 /* Rocket.svga */, + 71DAA8A42355B3ED006608A1 /* Goddess.svga */, + 71A8679022B7785100176CD6 /* matteRect.svga */, + 71A8679222B7853600176CD6 /* matteBitmap.svga */, + 71418C92225E6F710029C69E /* mutiMatte.svga */, + 63712E6421787950001AE014 /* heartbeat.svga */, 90D7CA1A1F7FB114006E74F0 /* rose_1.5.0.svga */, 90D7CA191F7FB114006E74F0 /* rose_2.0.0.svga */, ); @@ -247,7 +232,6 @@ children = ( 90D7CA1D1F7FB34E006E74F0 /* libz.tbd */, 1DDA5FF396660C7C932DF9B8 /* libPods-SVGAPlayer.a */, - 92332F7A897BF4379D765B05 /* libPods-SVGAPlayer React.a */, ); name = Frameworks; sourceTree = ""; @@ -263,8 +247,6 @@ 90A676D91D13A6DF008A69F3 /* Sources */, 90A676DA1D13A6DF008A69F3 /* Frameworks */, 90A676DB1D13A6DF008A69F3 /* Resources */, - 90CFF6F7E27D61F7415658A8 /* [CP] Embed Pods Frameworks */, - 30824E0A5B95B78BA26133C9 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -275,26 +257,6 @@ productReference = 90A676DD1D13A6DF008A69F3 /* SVGAPlayer.app */; productType = "com.apple.product-type.application"; }; - 90CB64C91EF290F400DAA382 /* SVGAPlayer React */ = { - isa = PBXNativeTarget; - buildConfigurationList = 90CB64E21EF290F400DAA382 /* Build configuration list for PBXNativeTarget "SVGAPlayer React" */; - buildPhases = ( - 890FC763F2C82314110A5C8F /* [CP] Check Pods Manifest.lock */, - 90CB64CB1EF290F400DAA382 /* Sources */, - 90CB64DA1EF290F400DAA382 /* Frameworks */, - 90CB64DC1EF290F400DAA382 /* Resources */, - 97FF02AF76FF679B16FE6BE5 /* [CP] Embed Pods Frameworks */, - 954F7371F8B4658670CCA7D4 /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "SVGAPlayer React"; - productName = SVGAPlayer; - productReference = 90CB64E51EF290F400DAA382 /* SVGAPlayer React.app */; - productType = "com.apple.product-type.application"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -306,10 +268,7 @@ TargetAttributes = { 90A676DC1D13A6DF008A69F3 = { CreatedOnToolsVersion = 7.3; - DevelopmentTeam = 8M2FQ87SLP; - }; - 90CB64C91EF290F400DAA382 = { - DevelopmentTeam = 8M2FQ87SLP; + DevelopmentTeam = S2RM275849; }; }; }; @@ -318,6 +277,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -327,7 +287,6 @@ projectRoot = ""; targets = ( 90A676DC1D13A6DF008A69F3 /* SVGAPlayer */, - 90CB64C91EF290F400DAA382 /* SVGAPlayer React */, ); }; /* End PBXProject section */ @@ -337,106 +296,25 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 71418C93225E6F710029C69E /* mutiMatte.svga in Resources */, 90A676F01D13A6DF008A69F3 /* LaunchScreen.storyboard in Resources */, + 718A146D235718E000FED5D3 /* Rocket.svga in Resources */, 90A676ED1D13A6DF008A69F3 /* Assets.xcassets in Resources */, + 63712E6521787950001AE014 /* heartbeat.svga in Resources */, 90A676EB1D13A6DF008A69F3 /* Main.storyboard in Resources */, 90CB64F91EF297E800DAA382 /* SVGAPlayer React-Info.plist in Resources */, + 71A8679122B7785100176CD6 /* matteRect.svga in Resources */, + 71A8679322B7853600176CD6 /* matteBitmap.svga in Resources */, 90D7CA1C1F7FB114006E74F0 /* rose_1.5.0.svga in Resources */, 90D7CA1B1F7FB114006E74F0 /* rose_2.0.0.svga in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 90CB64DC1EF290F400DAA382 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 90CB64DD1EF290F400DAA382 /* LaunchScreen.storyboard in Resources */, - 90CB64DE1EF290F400DAA382 /* Assets.xcassets in Resources */, - 90CB64DF1EF290F400DAA382 /* Main.storyboard in Resources */, + E83A58D9247E0E6A00D9F404 /* audio_biling.svga in Resources */, + 71DAA8A52355B3ED006608A1 /* Goddess.svga in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 30824E0A5B95B78BA26133C9 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SVGAPlayer/Pods-SVGAPlayer-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 890FC763F2C82314110A5C8F /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-SVGAPlayer React-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - 90CFF6F7E27D61F7415658A8 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SVGAPlayer/Pods-SVGAPlayer-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 954F7371F8B4658670CCA7D4 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SVGAPlayer React/Pods-SVGAPlayer React-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 97FF02AF76FF679B16FE6BE5 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SVGAPlayer React/Pods-SVGAPlayer React-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; CD70B01EE331E392E355CD26 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -466,6 +344,8 @@ 9052FC631E6EB8D4007BC925 /* SVGAExporter.m in Sources */, 90A677031D13AE19008A69F3 /* SVGAVideoEntity.m in Sources */, 90A364DA1E5AED04009347F1 /* SVGAVideoSpriteFrameEntity.m in Sources */, + 63712E6821787A45001AE014 /* SVGAAudioEntity.m in Sources */, + 63E817012178809D001D2D62 /* SVGAAudioLayer.m in Sources */, 90A364D11E5AEC11009347F1 /* SVGABitmapLayer.m in Sources */, 904D41F81D223DD20085A21A /* SVGABezierPath.m in Sources */, 90A364D71E5AECBD009347F1 /* SVGAVideoSpriteEntity.m in Sources */, @@ -481,28 +361,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 90CB64CB1EF290F400DAA382 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 90CB64F71EF2925000DAA382 /* SVGAPlayerManager.m in Sources */, - 90CB64CC1EF290F400DAA382 /* ViewController.m in Sources */, - 90CB64CD1EF290F400DAA382 /* SVGAExporter.m in Sources */, - 90CB64CE1EF290F400DAA382 /* SVGAVideoEntity.m in Sources */, - 90CB64CF1EF290F400DAA382 /* SVGAVideoSpriteFrameEntity.m in Sources */, - 90CB64D01EF290F400DAA382 /* SVGABitmapLayer.m in Sources */, - 90CB64D11EF290F400DAA382 /* SVGABezierPath.m in Sources */, - 90CB64D21EF290F400DAA382 /* SVGAVideoSpriteEntity.m in Sources */, - 90CB64D31EF290F400DAA382 /* AppDelegate.m in Sources */, - 90CB64D41EF290F400DAA382 /* SVGAContentLayer.m in Sources */, - 90CB64D51EF290F400DAA382 /* SVGA.m in Sources */, - 90CB64D61EF290F400DAA382 /* SVGAPlayer.m in Sources */, - 90CB64D71EF290F400DAA382 /* SVGAVectorLayer.m in Sources */, - 90CB64D81EF290F400DAA382 /* main.m in Sources */, - 90CB64D91EF290F400DAA382 /* SVGAParser.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ @@ -613,6 +471,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; + DEVELOPMENT_TEAM = S2RM275849; INFOPLIST_FILE = SVGAPlayer/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -629,6 +488,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; + DEVELOPMENT_TEAM = S2RM275849; INFOPLIST_FILE = SVGAPlayer/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -639,40 +499,6 @@ }; name = Release; }; - 90CB64E31EF290F400DAA382 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 2EF4851C027B3C0E45E3C5C0 /* Pods-SVGAPlayer React.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_IDENTITY = "iPhone Developer"; - DEVELOPMENT_TEAM = 8M2FQ87SLP; - INFOPLIST_FILE = "$(SRCROOT)/SVGAPlayer/SVGAPlayer React-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.opensource.SVGAPlayer; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = ""; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 90CB64E41EF290F400DAA382 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = FF89C40C3E9839DA5DE71191 /* Pods-SVGAPlayer React.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_IDENTITY = "iPhone Developer"; - DEVELOPMENT_TEAM = 8M2FQ87SLP; - INFOPLIST_FILE = "$(SRCROOT)/SVGAPlayer/SVGAPlayer React-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.opensource.SVGAPlayer; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = ""; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -694,15 +520,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 90CB64E21EF290F400DAA382 /* Build configuration list for PBXNativeTarget "SVGAPlayer React" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 90CB64E31EF290F400DAA382 /* Debug */, - 90CB64E41EF290F400DAA382 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ }; rootObject = 90A676D51D13A6DF008A69F3 /* Project object */; diff --git a/SVGAPlayer.xcodeproj/xcshareddata/xcschemes/SVGAPlayer.xcscheme b/SVGAPlayer.xcodeproj/xcshareddata/xcschemes/SVGAPlayer.xcscheme new file mode 100644 index 00000000..55f72e87 --- /dev/null +++ b/SVGAPlayer.xcodeproj/xcshareddata/xcschemes/SVGAPlayer.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SVGAPlayer.xcodeproj/xcuserdata/errnull.xcuserdatad/xcschemes/xcschememanagement.plist b/SVGAPlayer.xcodeproj/xcuserdata/errnull.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 00000000..d0671ccd --- /dev/null +++ b/SVGAPlayer.xcodeproj/xcuserdata/errnull.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + SVGAPlayer React.xcscheme_^#shared#^_ + + orderHint + 7 + + SVGAPlayer.xcscheme_^#shared#^_ + + orderHint + 5 + + + SuppressBuildableAutocreation + + 90A676DC1D13A6DF008A69F3 + + primary + + + + + diff --git a/SVGAPlayer.xcodeproj/xcuserdata/saiakirahui.xcuserdatad/xcschemes/xcschememanagement.plist b/SVGAPlayer.xcodeproj/xcuserdata/saiakirahui.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 00000000..ef983a68 --- /dev/null +++ b/SVGAPlayer.xcodeproj/xcuserdata/saiakirahui.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,29 @@ + + + + + SchemeUserState + + SVGAPlayer React.xcscheme + + orderHint + 7 + + SVGAPlayer React.xcscheme_^#shared#^_ + + orderHint + 4 + + SVGAPlayer.xcscheme + + orderHint + 6 + + SVGAPlayer.xcscheme_^#shared#^_ + + orderHint + 3 + + + + diff --git a/SVGAPlayer.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SVGAPlayer.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/SVGAPlayer.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/SVGAPlayer.xcworkspace/xcuserdata/errnull.xcuserdatad/UserInterfaceState.xcuserstate b/SVGAPlayer.xcworkspace/xcuserdata/errnull.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 00000000..72f68972 Binary files /dev/null and b/SVGAPlayer.xcworkspace/xcuserdata/errnull.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/SVGAPlayer.xcworkspace/xcuserdata/errnull.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/SVGAPlayer.xcworkspace/xcuserdata/errnull.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 00000000..ff2cec0e --- /dev/null +++ b/SVGAPlayer.xcworkspace/xcuserdata/errnull.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SVGAPlayer.xcworkspace/xcuserdata/saiakirahui.xcuserdatad/UserInterfaceState.xcuserstate b/SVGAPlayer.xcworkspace/xcuserdata/saiakirahui.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 00000000..bf9bfea7 Binary files /dev/null and b/SVGAPlayer.xcworkspace/xcuserdata/saiakirahui.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/SVGAPlayer/Assets.xcassets/AppIcon.appiconset/Contents.json b/SVGAPlayer/Assets.xcassets/AppIcon.appiconset/Contents.json index 118c98f7..19882d56 100644 --- a/SVGAPlayer/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/SVGAPlayer/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", @@ -29,6 +39,11 @@ "idiom" : "iphone", "size" : "60x60", "scale" : "3x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/SVGAPlayer/Assets.xcassets/Contents.json b/SVGAPlayer/Assets.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/SVGAPlayer/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SVGAPlayer/Assets.xcassets/begin.imageset/Contents.json b/SVGAPlayer/Assets.xcassets/begin.imageset/Contents.json new file mode 100644 index 00000000..5851f27d --- /dev/null +++ b/SVGAPlayer/Assets.xcassets/begin.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "begin@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SVGAPlayer/Assets.xcassets/begin.imageset/begin@2x.png b/SVGAPlayer/Assets.xcassets/begin.imageset/begin@2x.png new file mode 100644 index 00000000..9394c657 Binary files /dev/null and b/SVGAPlayer/Assets.xcassets/begin.imageset/begin@2x.png differ diff --git a/SVGAPlayer/Assets.xcassets/purse.imageset/Contents.json b/SVGAPlayer/Assets.xcassets/purse.imageset/Contents.json new file mode 100644 index 00000000..f94fde85 --- /dev/null +++ b/SVGAPlayer/Assets.xcassets/purse.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "purse@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SVGAPlayer/Assets.xcassets/purse.imageset/purse@2x.png b/SVGAPlayer/Assets.xcassets/purse.imageset/purse@2x.png new file mode 100644 index 00000000..abddd43d Binary files /dev/null and b/SVGAPlayer/Assets.xcassets/purse.imageset/purse@2x.png differ diff --git a/SVGAPlayer/Base.lproj/Main.storyboard b/SVGAPlayer/Base.lproj/Main.storyboard index dd275422..3ffed2c3 100644 --- a/SVGAPlayer/Base.lproj/Main.storyboard +++ b/SVGAPlayer/Base.lproj/Main.storyboard @@ -1,11 +1,11 @@ - + - + @@ -20,7 +20,170 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -29,16 +192,22 @@ + + + + + + - + diff --git a/SVGAPlayer/Samples/Goddess.svga b/SVGAPlayer/Samples/Goddess.svga new file mode 100644 index 00000000..ae27052e Binary files /dev/null and b/SVGAPlayer/Samples/Goddess.svga differ diff --git a/SVGAPlayer/Samples/Rocket.svga b/SVGAPlayer/Samples/Rocket.svga new file mode 100644 index 00000000..9f134618 Binary files /dev/null and b/SVGAPlayer/Samples/Rocket.svga differ diff --git a/SVGAPlayer/Samples/audio_biling.svga b/SVGAPlayer/Samples/audio_biling.svga new file mode 100644 index 00000000..d9b71669 Binary files /dev/null and b/SVGAPlayer/Samples/audio_biling.svga differ diff --git a/SVGAPlayer/Samples/heartbeat.svga b/SVGAPlayer/Samples/heartbeat.svga new file mode 100644 index 00000000..64f010de Binary files /dev/null and b/SVGAPlayer/Samples/heartbeat.svga differ diff --git a/SVGAPlayer/Samples/matteBitmap.svga b/SVGAPlayer/Samples/matteBitmap.svga new file mode 100644 index 00000000..c73db699 Binary files /dev/null and b/SVGAPlayer/Samples/matteBitmap.svga differ diff --git a/SVGAPlayer/Samples/matteBitmap_1.x.svga b/SVGAPlayer/Samples/matteBitmap_1.x.svga new file mode 100644 index 00000000..f65e8aad Binary files /dev/null and b/SVGAPlayer/Samples/matteBitmap_1.x.svga differ diff --git a/SVGAPlayer/Samples/matteRect.svga b/SVGAPlayer/Samples/matteRect.svga new file mode 100644 index 00000000..c158c4b6 Binary files /dev/null and b/SVGAPlayer/Samples/matteRect.svga differ diff --git a/SVGAPlayer/Samples/mutiMatte.svga b/SVGAPlayer/Samples/mutiMatte.svga new file mode 100644 index 00000000..47f58117 Binary files /dev/null and b/SVGAPlayer/Samples/mutiMatte.svga differ diff --git a/SVGAPlayer/ViewController.m b/SVGAPlayer/ViewController.m index e2a316b3..97e52729 100644 --- a/SVGAPlayer/ViewController.m +++ b/SVGAPlayer/ViewController.m @@ -11,7 +11,9 @@ @interface ViewController () -@property (nonatomic, strong) SVGAPlayer *aPlayer; +@property (weak, nonatomic) IBOutlet SVGAPlayer *aPlayer; +@property (weak, nonatomic) IBOutlet UISlider *aSlider; +@property (weak, nonatomic) IBOutlet UIButton *onBeginButton; @end @@ -21,51 +23,107 @@ @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; - - self.view.backgroundColor = [UIColor blackColor]; - [self.view addSubview:self.aPlayer]; self.aPlayer.delegate = self; - self.aPlayer.frame = CGRectMake(0, 0, 320, 320); - self.aPlayer.loops = 0; + self.aPlayer.loops = 1; self.aPlayer.clearsAfterStop = YES; parser = [[SVGAParser alloc] init]; [self onChange:nil]; } -- (void)viewWillLayoutSubviews { - [super viewWillLayoutSubviews]; - self.aPlayer.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height); +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { + [super touchesBegan:touches withEvent:event]; + [self onBeginButton:self.onBeginButton]; } - (IBAction)onChange:(id)sender { NSArray *items = @[ - @"https://github.com/yyued/SVGA-Samples/blob/master/EmptyState.svga?raw=true", - @"https://github.com/yyued/SVGA-Samples/blob/master/HamburgerArrow.svga?raw=true", - @"https://github.com/yyued/SVGA-Samples/blob/master/PinJump.svga?raw=true", - @"https://github.com/yyued/SVGA-Samples/blob/master/TwitterHeart.svga?raw=true", - @"https://github.com/yyued/SVGA-Samples/blob/master/Walkthrough.svga?raw=true", - @"https://github.com/yyued/SVGA-Samples/blob/master/angel.svga?raw=true", - @"https://github.com/yyued/SVGA-Samples/blob/master/halloween.svga?raw=true", - @"https://github.com/yyued/SVGA-Samples/blob/master/kingset.svga?raw=true", - @"https://github.com/yyued/SVGA-Samples/blob/master/posche.svga?raw=true", - @"https://github.com/yyued/SVGA-Samples/blob/master/rose.svga?raw=true", + @"https://cdn.jsdelivr.net/gh/svga/SVGA-Samples@master/EmptyState.svga?raw=true", + @"https://cdn.jsdelivr.net/gh/svga/SVGA-Samples@master/HamburgerArrow.svga?raw=true", + @"https://cdn.jsdelivr.net/gh/svga/SVGA-Samples@master/PinJump.svga?raw=true", + @"https://github.com/svga/SVGA-Samples/raw/master/Rocket.svga", + @"https://cdn.jsdelivr.net/gh/svga/SVGA-Samples@master/TwitterHeart.svga?raw=true", + @"https://cdn.jsdelivr.net/gh/svga/SVGA-Samples@master/Walkthrough.svga?raw=true", + @"https://cdn.jsdelivr.net/gh/svga/SVGA-Samples@master/angel.svga?raw=true", + @"https://cdn.jsdelivr.net/gh/svga/SVGA-Samples@master/halloween.svga?raw=true", + @"https://cdn.jsdelivr.net/gh/svga/SVGA-Samples@master/kingset.svga?raw=true", + @"https://cdn.jsdelivr.net/gh/svga/SVGA-Samples@master/posche.svga?raw=true", + @"https://cdn.jsdelivr.net/gh/svga/SVGA-Samples@master/rose.svga?raw=true", ]; [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; - [parser parseWithURL:[NSURL URLWithString:items[arc4random() % 10]] +// parser.enabledMemoryCache = YES; + [parser parseWithURL:[NSURL URLWithString:items[arc4random() % items.count]] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) { [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; - if (videoItem != nil) { - self.aPlayer.videoItem = videoItem; - [self.aPlayer startAnimation]; - } - } failureBlock:nil]; + if (videoItem != nil) { + self.aPlayer.videoItem = videoItem; + NSMutableParagraphStyle *para = [[NSMutableParagraphStyle alloc] init]; + [para setLineBreakMode:NSLineBreakByTruncatingTail]; + [para setAlignment:NSTextAlignmentCenter]; + NSAttributedString *str = [[NSAttributedString alloc] + initWithString:@"Hello, World! Hello, World!" + attributes:@{ + NSFontAttributeName: [UIFont systemFontOfSize:28], + NSForegroundColorAttributeName: [UIColor whiteColor], + NSParagraphStyleAttributeName: para, + }]; + [self.aPlayer setAttributedText:str forKey:@"banner"]; + + [self.aPlayer startAnimation]; + +// [self.aPlayer startAnimationWithRange:NSMakeRange(10, 25) reverse:YES]; + } + } failureBlock:nil]; +// +// [parser parseWithURL:[NSURL URLWithString:@"https://github.com/svga/SVGA-Samples/raw/master_aep/BitmapColorArea1.svga"] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) { +// if (videoItem != nil) { +// self.aPlayer.videoItem = videoItem; +// [self.aPlayer setImageWithURL:[NSURL URLWithString: @"https://i.imgur.com/vd4GuUh.png"] forKey:@"matte_EEKdlEml.matte"]; +// [self.aPlayer startAnimation]; +// } +// } failureBlock:nil]; + +// [parser parseWithNamed:@"Rocket" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { +// self.aPlayer.videoItem = videoItem; +// [self.aPlayer startAnimation]; +// } failureBlock:nil]; +} + +- (IBAction)onSliderClick:(UISlider *)sender { + [self.aPlayer stepToPercentage:sender.value andPlay:NO]; +} + +- (IBAction)onSlide:(UISlider *)sender { + [self.aPlayer stepToPercentage:sender.value andPlay:NO]; +} + +- (IBAction)onChangeColor:(UIButton *)sender { + self.view.backgroundColor = sender.backgroundColor; } -- (SVGAPlayer *)aPlayer { - if (_aPlayer == nil) { - _aPlayer = [[SVGAPlayer alloc] init]; +- (IBAction)onBeginButton:(UIButton *)sender { + sender.selected = !sender.isSelected; + if (sender.selected) { + [self.aPlayer pauseAnimation]; + } else { + [self.aPlayer stepToPercentage:(self.aSlider.value == 1 ? 0 : self.aSlider.value) andPlay:YES]; } - return _aPlayer; } +- (IBAction)onRetreatButton:(UIButton *)sender { + +} + +- (IBAction)onForwardButton:(UIButton *)sender { + +} + + +#pragma - mark SVGAPlayer Delegate +- (void)svgaPlayerDidAnimatedToPercentage:(CGFloat)percentage { + self.aSlider.value = percentage; +} + +- (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player { + self.onBeginButton.selected = YES; +} @end diff --git a/Source/SVGA.h b/Source/SVGA.h index 71c624a3..118ff4fd 100644 --- a/Source/SVGA.h +++ b/Source/SVGA.h @@ -9,6 +9,8 @@ #import #import "SVGAParser.h" #import "SVGAPlayer.h" +#import "SVGAImageView.h" +#import "SVGAVideoEntity.h" #import "SVGAExporter.h" @interface SVGA : NSObject diff --git a/Source/SVGAAudioEntity.h b/Source/SVGAAudioEntity.h new file mode 100644 index 00000000..2402dceb --- /dev/null +++ b/Source/SVGAAudioEntity.h @@ -0,0 +1,22 @@ +// +// SVGAAudioEntity.h +// SVGAPlayer +// +// Created by PonyCui on 2018/10/18. +// Copyright © 2018年 UED Center. All rights reserved. +// + +#import + +@class SVGAProtoAudioEntity; + +@interface SVGAAudioEntity : NSObject + +@property (nonatomic, readonly) NSString *audioKey; +@property (nonatomic, readonly) NSInteger startFrame; +@property (nonatomic, readonly) NSInteger endFrame; +@property (nonatomic, readonly) NSInteger startTime; + +- (instancetype)initWithProtoObject:(SVGAProtoAudioEntity *)protoObject; + +@end diff --git a/Source/SVGAAudioEntity.m b/Source/SVGAAudioEntity.m new file mode 100644 index 00000000..f44fc5ce --- /dev/null +++ b/Source/SVGAAudioEntity.m @@ -0,0 +1,34 @@ +// +// SVGAAudioEntity.m +// SVGAPlayer +// +// Created by PonyCui on 2018/10/18. +// Copyright © 2018年 UED Center. All rights reserved. +// + +#import "SVGAAudioEntity.h" +#import "Svga.pbobjc.h" + +@interface SVGAAudioEntity () + +@property (nonatomic, readwrite) NSString *audioKey; +@property (nonatomic, readwrite) NSInteger startFrame; +@property (nonatomic, readwrite) NSInteger endFrame; +@property (nonatomic, readwrite) NSInteger startTime; + +@end + +@implementation SVGAAudioEntity + +- (instancetype)initWithProtoObject:(SVGAProtoAudioEntity *)protoObject { + self = [super init]; + if (self) { + _audioKey = protoObject.audioKey; + _startFrame = protoObject.startFrame; + _endFrame = protoObject.endFrame; + _startTime = protoObject.startTime; + } + return self; +} + +@end diff --git a/Source/SVGAAudioLayer.h b/Source/SVGAAudioLayer.h new file mode 100644 index 00000000..97ee6f41 --- /dev/null +++ b/Source/SVGAAudioLayer.h @@ -0,0 +1,23 @@ +// +// SVGAAudioLayer.h +// SVGAPlayer +// +// Created by PonyCui on 2018/10/18. +// Copyright © 2018年 UED Center. All rights reserved. +// + +#import +#import + +@class SVGAAudioEntity, SVGAVideoEntity; + +@interface SVGAAudioLayer : NSObject + +@property (nonatomic, readonly) AVAudioPlayer *audioPlayer; +@property (nonatomic, readonly) SVGAAudioEntity *audioItem; +@property (nonatomic, assign) BOOL audioPlaying; + + +- (instancetype)initWithAudioItem:(SVGAAudioEntity *)audioItem videoItem:(SVGAVideoEntity *)videoItem; + +@end diff --git a/Source/SVGAAudioLayer.m b/Source/SVGAAudioLayer.m new file mode 100644 index 00000000..f6ec7f29 --- /dev/null +++ b/Source/SVGAAudioLayer.m @@ -0,0 +1,37 @@ +// +// SVGAAudioLayer.m +// SVGAPlayer +// +// Created by PonyCui on 2018/10/18. +// Copyright © 2018年 UED Center. All rights reserved. +// + +#import "SVGAAudioLayer.h" +#import "SVGAAudioEntity.h" +#import "SVGAVideoEntity.h" + +@interface SVGAAudioLayer () + +@property (nonatomic, readwrite) AVAudioPlayer *audioPlayer; +@property (nonatomic, readwrite) SVGAAudioEntity *audioItem; + +@end + +@implementation SVGAAudioLayer + +- (instancetype)initWithAudioItem:(SVGAAudioEntity *)audioItem videoItem:(SVGAVideoEntity *)videoItem +{ + self = [super init]; + if (self) { + _audioItem = audioItem; + if (audioItem.audioKey != nil && videoItem.audiosData[audioItem.audioKey] != nil) { + _audioPlayer = [[AVAudioPlayer alloc] initWithData:videoItem.audiosData[audioItem.audioKey] + fileTypeHint:@"mp3" + error:NULL]; + [_audioPlayer prepareToPlay]; + } + } + return self; +} + +@end diff --git a/Source/SVGAContentLayer.h b/Source/SVGAContentLayer.h index cef20db3..7343865f 100644 --- a/Source/SVGAContentLayer.h +++ b/Source/SVGAContentLayer.h @@ -7,12 +7,15 @@ // #import +#import "SVGAPlayer.h" @class SVGABitmapLayer, SVGAVectorLayer, SVGAVideoSpriteFrameEntity; @interface SVGAContentLayer : CALayer @property (nonatomic, strong) NSString *imageKey; +@property (nonatomic, assign) BOOL dynamicHidden; +@property (nonatomic, copy) SVGAPlayerDynamicDrawingBlock dynamicDrawingBlock; @property (nonatomic, strong) SVGABitmapLayer *bitmapLayer; @property (nonatomic, strong) SVGAVectorLayer *vectorLayer; @property (nonatomic, strong) CATextLayer *textLayer; @@ -20,5 +23,6 @@ - (instancetype)initWithFrames:(NSArray *)frames; - (void)stepToFrame:(NSInteger)frame; +- (void)resetTextLayerProperties:(NSAttributedString *)attributedString; @end diff --git a/Source/SVGAContentLayer.m b/Source/SVGAContentLayer.m index 512987a1..471a741e 100644 --- a/Source/SVGAContentLayer.m +++ b/Source/SVGAContentLayer.m @@ -14,6 +14,7 @@ @interface SVGAContentLayer () @property (nonatomic, strong) NSArray *frames; +@property (nonatomic, assign) NSTextAlignment textLayerAlignment; @end @@ -25,12 +26,16 @@ - (instancetype)initWithFrames:(NSArray *)frames { self.backgroundColor = [UIColor clearColor].CGColor; self.masksToBounds = NO; _frames = frames; + _textLayerAlignment = NSTextAlignmentCenter; [self stepToFrame:0]; } return self; } - (void)stepToFrame:(NSInteger)frame { + if (self.dynamicHidden) { + return; + } if (frame < self.frames.count) { SVGAVideoSpriteFrameEntity *frameItem = self.frames[frame]; if (frameItem.alpha > 0.0) { @@ -45,13 +50,26 @@ - (void)stepToFrame:(NSInteger)frame { CGFloat offsetX = self.frame.origin.x - nx; CGFloat offsetY = self.frame.origin.y - ny; self.position = CGPointMake(self.position.x - offsetX, self.position.y - offsetY); - self.mask = frameItem.maskLayer; + if (frameItem.maskLayer != nil) { + if ([frameItem.maskLayer isKindOfClass:[CAShapeLayer class]]) { + CAShapeLayer *cloneShapeLayer = [CAShapeLayer layer]; + cloneShapeLayer.path = [(CAShapeLayer *)frameItem.maskLayer path]; + cloneShapeLayer.fillColor = [(CAShapeLayer *)frameItem.maskLayer fillColor]; + self.mask = cloneShapeLayer; + } + } + else { + self.mask = nil; + } [self.bitmapLayer stepToFrame:frame]; [self.vectorLayer stepToFrame:frame]; } else { self.hidden = YES; } + if (self.dynamicDrawingBlock) { + self.dynamicDrawingBlock(self, frame); + } } } @@ -62,7 +80,20 @@ - (void)setFrame:(CGRect)frame { for (CALayer *sublayer in self.sublayers) { if ([sublayer isKindOfClass:[CATextLayer class]]) { CGRect frame = sublayer.frame; - frame.origin.x = (self.frame.size.width - sublayer.frame.size.width) / 2.0; + switch (self.textLayerAlignment) { + case NSTextAlignmentLeft: + frame.origin.x = 0.0; + break; + case NSTextAlignmentCenter: + frame.origin.x = (self.frame.size.width - sublayer.frame.size.width) / 2.0; + break; + case NSTextAlignmentRight: + frame.origin.x = self.frame.size.width - sublayer.frame.size.width; + break; + default: + frame.origin.x = (self.frame.size.width - sublayer.frame.size.width) / 2.0; + break; + } frame.origin.y = (self.frame.size.height - sublayer.frame.size.height) / 2.0; sublayer.frame = frame; } @@ -81,4 +112,39 @@ - (void)setVectorLayer:(SVGAVectorLayer *)vectorLayer { [self addSublayer:vectorLayer]; } +- (void)setDynamicHidden:(BOOL)dynamicHidden { + _dynamicHidden = dynamicHidden; + self.hidden = dynamicHidden; +} + +- (void)resetTextLayerProperties:(NSAttributedString *)attributedString { + NSDictionary *textAttrs = (id)[attributedString attributesAtIndex:0 effectiveRange:nil]; + NSParagraphStyle *paragraphStyle = textAttrs[NSParagraphStyleAttributeName]; + if (paragraphStyle == nil) { + return; + } + if (paragraphStyle.lineBreakMode == NSLineBreakByTruncatingTail) { + self.textLayer.truncationMode = kCATruncationEnd; + [self.textLayer setWrapped:NO]; + } + else if (paragraphStyle.lineBreakMode == NSLineBreakByTruncatingMiddle) { + self.textLayer.truncationMode = kCATruncationMiddle; + [self.textLayer setWrapped:NO]; + } + else if (paragraphStyle.lineBreakMode == NSLineBreakByTruncatingHead) { + self.textLayer.truncationMode = kCATruncationStart; + [self.textLayer setWrapped:NO]; + } + else { + self.textLayer.truncationMode = kCATruncationNone; + [self.textLayer setWrapped:YES]; + } + if (paragraphStyle.alignment == NSTextAlignmentNatural) { + self.textLayerAlignment = NSTextAlignmentCenter; + } + else { + self.textLayerAlignment = paragraphStyle.alignment; + } +} + @end diff --git a/Source/SVGAParser.h b/Source/SVGAParser.h index 39e4bd12..91ea6726 100644 --- a/Source/SVGAParser.h +++ b/Source/SVGAParser.h @@ -12,10 +12,16 @@ @interface SVGAParser : NSObject +@property (nonatomic, assign) BOOL enabledMemoryCache; + - (void)parseWithURL:(nonnull NSURL *)URL completionBlock:(void ( ^ _Nonnull )(SVGAVideoEntity * _Nullable videoItem))completionBlock failureBlock:(void ( ^ _Nullable)(NSError * _Nullable error))failureBlock; +- (void)parseWithURLRequest:(nonnull NSURLRequest *)URLRequest + completionBlock:(void ( ^ _Nonnull )(SVGAVideoEntity * _Nullable videoItem))completionBlock + failureBlock:(void ( ^ _Nullable)(NSError * _Nullable error))failureBlock; + - (void)parseWithData:(nonnull NSData *)data cacheKey:(nonnull NSString *)cacheKey completionBlock:(void ( ^ _Nullable)(SVGAVideoEntity * _Nonnull videoItem))completionBlock diff --git a/Source/SVGAParser.m b/Source/SVGAParser.m index fbedc53a..af7b07da 100644 --- a/Source/SVGAParser.m +++ b/Source/SVGAParser.m @@ -13,6 +13,8 @@ #import #import +#define ZIP_MAGIC_NUMBER "PK" + @interface SVGAParser () @end @@ -32,35 +34,59 @@ + (void)load { - (void)parseWithURL:(nonnull NSURL *)URL completionBlock:(void ( ^ _Nonnull )(SVGAVideoEntity * _Nullable videoItem))completionBlock failureBlock:(void ( ^ _Nullable)(NSError * _Nullable error))failureBlock { - if ([[NSFileManager defaultManager] fileExistsAtPath:[self cacheDirectory:[self cacheKey:URL]]]) { - [self parseWithCacheKey:[self cacheKey:URL] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { + [self parseWithURLRequest:[NSURLRequest requestWithURL:URL cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:20.0] + completionBlock:completionBlock + failureBlock:failureBlock]; +} + +- (void)parseWithURLRequest:(NSURLRequest *)URLRequest completionBlock:(void (^)(SVGAVideoEntity * _Nullable))completionBlock failureBlock:(void (^)(NSError * _Nullable))failureBlock { + if (URLRequest.URL == nil) { + if (failureBlock) { + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + failureBlock([NSError errorWithDomain:@"SVGAParser" code:411 userInfo:@{NSLocalizedDescriptionKey: @"URL cannot be nil."}]); + }]; + } + return; + } + if ([[NSFileManager defaultManager] fileExistsAtPath:[self cacheDirectory:[self cacheKey:URLRequest.URL]]]) { + [self parseWithCacheKey:[self cacheKey:URLRequest.URL] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { if (completionBlock) { - completionBlock(videoItem); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + completionBlock(videoItem); + }]; } } failureBlock:^(NSError * _Nonnull error) { - [self clearCache:[self cacheKey:URL]]; + [self clearCache:[self cacheKey:URLRequest.URL]]; if (failureBlock) { - failureBlock(error); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + failureBlock(error); + }]; } }]; return; } - [[[NSURLSession sharedSession] dataTaskWithURL:URL completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { + [[[NSURLSession sharedSession] dataTaskWithRequest:URLRequest completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { if (error == nil && data != nil) { - [self parseWithData:data cacheKey:[self cacheKey:URL] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { + [self parseWithData:data cacheKey:[self cacheKey:URLRequest.URL] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { if (completionBlock) { - completionBlock(videoItem); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + completionBlock(videoItem); + }]; } } failureBlock:^(NSError * _Nonnull error) { - [self clearCache:[self cacheKey:URL]]; + [self clearCache:[self cacheKey:URLRequest.URL]]; if (failureBlock) { - failureBlock(error); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + failureBlock(error); + }]; } }]; } else { if (failureBlock) { - failureBlock(error); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + failureBlock(error); + }]; } } }] resume]; @@ -71,16 +97,18 @@ - (void)parseWithNamed:(NSString *)named completionBlock:(void (^)(SVGAVideoEntity * _Nonnull))completionBlock failureBlock:(void (^)(NSError * _Nonnull))failureBlock { NSString *filePath = [(inBundle ?: [NSBundle mainBundle]) pathForResource:named ofType:@"svga"]; - if (filePath != nil) { - NSString *cacheKey = [self cacheKey:[NSURL fileURLWithPath:filePath]]; - [self parseWithData:[NSData dataWithContentsOfFile:filePath] - cacheKey:cacheKey - completionBlock:completionBlock - failureBlock:failureBlock]; - } - else { - failureBlock([NSError errorWithDomain:@"SVGAParser" code:404 userInfo:@{NSLocalizedDescriptionKey: @"File not exist."}]); + if (filePath == nil) { + if (failureBlock) { + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + failureBlock([NSError errorWithDomain:@"SVGAParser" code:404 userInfo:@{NSLocalizedDescriptionKey: @"File not exist."}]); + }]; + } + return; } + [self parseWithData:[NSData dataWithContentsOfFile:filePath] + cacheKey:[self cacheKey:[NSURL fileURLWithPath:filePath]] + completionBlock:completionBlock + failureBlock:failureBlock]; } - (void)parseWithCacheKey:(nonnull NSString *)cacheKey @@ -90,7 +118,9 @@ - (void)parseWithCacheKey:(nonnull NSString *)cacheKey SVGAVideoEntity *cacheItem = [SVGAVideoEntity readCache:cacheKey]; if (cacheItem != nil) { if (completionBlock) { - completionBlock(cacheItem); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + completionBlock(cacheItem); + }]; } return; } @@ -99,18 +129,27 @@ - (void)parseWithCacheKey:(nonnull NSString *)cacheKey NSError *err; NSData *protoData = [NSData dataWithContentsOfFile:[cacheDir stringByAppendingString:@"/movie.binary"]]; SVGAProtoMovieEntity *protoObject = [SVGAProtoMovieEntity parseFromData:protoData error:&err]; - if (!err) { + if (!err && [protoObject isKindOfClass:[SVGAProtoMovieEntity class]]) { SVGAVideoEntity *videoItem = [[SVGAVideoEntity alloc] initWithProtoObject:protoObject cacheDir:cacheDir]; [videoItem resetImagesWithProtoObject:protoObject]; [videoItem resetSpritesWithProtoObject:protoObject]; - [videoItem saveCache:cacheKey]; + [videoItem resetAudiosWithProtoObject:protoObject]; + if (self.enabledMemoryCache) { + [videoItem saveCache:cacheKey]; + } else { + [videoItem saveWeakCache:cacheKey]; + } if (completionBlock) { - completionBlock(videoItem); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + completionBlock(videoItem); + }]; } } else { if (failureBlock) { - failureBlock([NSError errorWithDomain:NSFilePathErrorKey code:-1 userInfo:nil]); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + failureBlock([NSError errorWithDomain:NSFilePathErrorKey code:-1 userInfo:nil]); + }]; } } } @@ -123,15 +162,23 @@ - (void)parseWithCacheKey:(nonnull NSString *)cacheKey SVGAVideoEntity *videoItem = [[SVGAVideoEntity alloc] initWithJSONObject:JSONObject cacheDir:cacheDir]; [videoItem resetImagesWithJSONObject:JSONObject]; [videoItem resetSpritesWithJSONObject:JSONObject]; - [videoItem saveCache:cacheKey]; + if (self.enabledMemoryCache) { + [videoItem saveCache:cacheKey]; + } else { + [videoItem saveWeakCache:cacheKey]; + } if (completionBlock) { - completionBlock(videoItem); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + completionBlock(videoItem); + }]; } } } else { if (failureBlock) { - failureBlock([NSError errorWithDomain:NSFilePathErrorKey code:-1 userInfo:nil]); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + failureBlock([NSError errorWithDomain:NSFilePathErrorKey code:-1 userInfo:nil]); + }]; } } } @@ -143,6 +190,14 @@ - (void)clearCache:(nonnull NSString *)cacheKey { [[NSFileManager defaultManager] removeItemAtPath:cacheDir error:NULL]; } ++ (BOOL)isZIPData:(NSData *)data { + BOOL result = NO; + if (!strncmp([data bytes], ZIP_MAGIC_NUMBER, strlen(ZIP_MAGIC_NUMBER))) { + result = YES; + } + return result; +} + - (void)parseWithData:(nonnull NSData *)data cacheKey:(nonnull NSString *)cacheKey completionBlock:(void ( ^ _Nullable)(SVGAVideoEntity * _Nonnull videoItem))completionBlock @@ -150,24 +205,35 @@ - (void)parseWithData:(nonnull NSData *)data SVGAVideoEntity *cacheItem = [SVGAVideoEntity readCache:cacheKey]; if (cacheItem != nil) { if (completionBlock) { - completionBlock(cacheItem); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + completionBlock(cacheItem); + }]; } return; } - NSData *tag = [data subdataWithRange:NSMakeRange(0, 4)]; - if (![[tag description] isEqualToString:@"<504b0304>"]) { + if (!data || data.length < 4) { + return; + } + if (![SVGAParser isZIPData:data]) { // Maybe is SVGA 2.0.0 [parseQueue addOperationWithBlock:^{ NSData *inflateData = [self zlibInflate:data]; NSError *err; SVGAProtoMovieEntity *protoObject = [SVGAProtoMovieEntity parseFromData:inflateData error:&err]; - if (!err) { + if (!err && [protoObject isKindOfClass:[SVGAProtoMovieEntity class]]) { SVGAVideoEntity *videoItem = [[SVGAVideoEntity alloc] initWithProtoObject:protoObject cacheDir:@""]; [videoItem resetImagesWithProtoObject:protoObject]; [videoItem resetSpritesWithProtoObject:protoObject]; - [videoItem saveCache:cacheKey]; + [videoItem resetAudiosWithProtoObject:protoObject]; + if (self.enabledMemoryCache) { + [videoItem saveCache:cacheKey]; + } else { + [videoItem saveWeakCache:cacheKey]; + } if (completionBlock) { - completionBlock(videoItem); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + completionBlock(videoItem); + }]; } } }]; @@ -177,12 +243,16 @@ - (void)parseWithData:(nonnull NSData *)data if ([[NSFileManager defaultManager] fileExistsAtPath:[self cacheDirectory:cacheKey]]) { [self parseWithCacheKey:cacheKey completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { if (completionBlock) { - completionBlock(videoItem); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + completionBlock(videoItem); + }]; } } failureBlock:^(NSError * _Nonnull error) { [self clearCache:cacheKey]; if (failureBlock) { - failureBlock(error); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + failureBlock(error); + }]; } }]; return; @@ -198,7 +268,9 @@ - (void)parseWithData:(nonnull NSData *)data } completionHandler:^(NSString *path, BOOL succeeded, NSError *error) { if (error != nil) { if (failureBlock) { - failureBlock(error); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + failureBlock(error); + }]; } } else { @@ -210,14 +282,22 @@ - (void)parseWithData:(nonnull NSData *)data SVGAVideoEntity *videoItem = [[SVGAVideoEntity alloc] initWithProtoObject:protoObject cacheDir:cacheDir]; [videoItem resetImagesWithProtoObject:protoObject]; [videoItem resetSpritesWithProtoObject:protoObject]; - [videoItem saveCache:cacheKey]; + if (self.enabledMemoryCache) { + [videoItem saveCache:cacheKey]; + } else { + [videoItem saveWeakCache:cacheKey]; + } if (completionBlock) { - completionBlock(videoItem); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + completionBlock(videoItem); + }]; } } else { if (failureBlock) { - failureBlock([NSError errorWithDomain:NSFilePathErrorKey code:-1 userInfo:nil]); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + failureBlock([NSError errorWithDomain:NSFilePathErrorKey code:-1 userInfo:nil]); + }]; } } } @@ -230,15 +310,23 @@ - (void)parseWithData:(nonnull NSData *)data SVGAVideoEntity *videoItem = [[SVGAVideoEntity alloc] initWithJSONObject:JSONObject cacheDir:cacheDir]; [videoItem resetImagesWithJSONObject:JSONObject]; [videoItem resetSpritesWithJSONObject:JSONObject]; - [videoItem saveCache:cacheKey]; + if (self.enabledMemoryCache) { + [videoItem saveCache:cacheKey]; + } else { + [videoItem saveWeakCache:cacheKey]; + } if (completionBlock) { - completionBlock(videoItem); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + completionBlock(videoItem); + }]; } } } else { if (failureBlock) { - failureBlock([NSError errorWithDomain:NSFilePathErrorKey code:-1 userInfo:nil]); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + failureBlock([NSError errorWithDomain:NSFilePathErrorKey code:-1 userInfo:nil]); + }]; } } } @@ -247,13 +335,17 @@ - (void)parseWithData:(nonnull NSData *)data } else { if (failureBlock) { - failureBlock([NSError errorWithDomain:NSFilePathErrorKey code:-1 userInfo:nil]); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + failureBlock([NSError errorWithDomain:NSFilePathErrorKey code:-1 userInfo:nil]); + }]; } } } else { if (failureBlock) { - failureBlock([NSError errorWithDomain:@"Data Error" code:-1 userInfo:nil]); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + failureBlock([NSError errorWithDomain:@"Data Error" code:-1 userInfo:nil]); + }]; } } }]; @@ -284,7 +376,7 @@ - (NSString *)MD5String:(NSString *)str { - (NSData *)zlibInflate:(NSData *)data { if ([data length] == 0) return data; - + unsigned full_length = (unsigned)[data length]; unsigned half_length = (unsigned)[data length] / 2; diff --git a/Source/SVGAPlayer.h b/Source/SVGAPlayer.h index f5cd79e0..cdeb8ccf 100644 --- a/Source/SVGAPlayer.h +++ b/Source/SVGAPlayer.h @@ -13,12 +13,18 @@ @protocol SVGAPlayerDelegate @optional -- (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player; -- (void)svgaPlayerDidAnimatedToFrame:(NSInteger)frame; -- (void)svgaPlayerDidAnimatedToPercentage:(CGFloat)percentage; +- (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player ; + +- (void)svgaPlayer:(SVGAPlayer *)player didAnimatedToFrame:(NSInteger)frame; +- (void)svgaPlayer:(SVGAPlayer *)player didAnimatedToPercentage:(CGFloat)percentage; + +- (void)svgaPlayerDidAnimatedToFrame:(NSInteger)frame API_DEPRECATED("Use svgaPlayer:didAnimatedToFrame: instead", ios(7.0, API_TO_BE_DEPRECATED)); +- (void)svgaPlayerDidAnimatedToPercentage:(CGFloat)percentage API_DEPRECATED("Use svgaPlayer:didAnimatedToPercentage: instead", ios(7.0, API_TO_BE_DEPRECATED)); @end +typedef void(^SVGAPlayerDynamicDrawingBlock)(CALayer *contentLayer, NSInteger frameIndex); + @interface SVGAPlayer : UIView @property (nonatomic, weak) id delegate; @@ -26,6 +32,7 @@ @property (nonatomic, assign) IBInspectable int loops; @property (nonatomic, assign) IBInspectable BOOL clearsAfterStop; @property (nonatomic, copy) NSString *fillMode; +@property (nonatomic, copy) NSRunLoopMode mainRunLoopMode; - (void)startAnimation; - (void)startAnimationWithRange:(NSRange)range reverse:(BOOL)reverse; @@ -41,6 +48,8 @@ - (void)setImageWithURL:(NSURL *)URL forKey:(NSString *)aKey; - (void)setImage:(UIImage *)image forKey:(NSString *)aKey referenceLayer:(CALayer *)referenceLayer; // deprecated from 2.0.1 - (void)setAttributedText:(NSAttributedString *)attributedText forKey:(NSString *)aKey; +- (void)setDrawingBlock:(SVGAPlayerDynamicDrawingBlock)drawingBlock forKey:(NSString *)aKey; +- (void)setHidden:(BOOL)hidden forKey:(NSString *)aKey; - (void)clearDynamicObjects; @end diff --git a/Source/SVGAPlayer.m b/Source/SVGAPlayer.m index ec999fb3..289e09f0 100644 --- a/Source/SVGAPlayer.m +++ b/Source/SVGAPlayer.m @@ -13,31 +13,55 @@ #import "SVGAContentLayer.h" #import "SVGABitmapLayer.h" #import "SVGAVectorLayer.h" +#import "SVGAAudioLayer.h" +#import "SVGAAudioEntity.h" @interface SVGAPlayer () @property (nonatomic, strong) CALayer *drawLayer; +@property (nonatomic, strong) NSArray *audioLayers; @property (nonatomic, strong) CADisplayLink *displayLink; @property (nonatomic, assign) NSInteger currentFrame; -@property (nonatomic, copy) NSDictionary *dynamicObjects; -@property (nonatomic, copy) NSDictionary *dynamicTexts; +@property (nonatomic, copy) NSArray *contentLayers; +@property (nonatomic, copy) NSDictionary *dynamicObjects; +@property (nonatomic, copy) NSDictionary *dynamicTexts; +@property (nonatomic, copy) NSDictionary *dynamicDrawings; +@property (nonatomic, copy) NSDictionary *dynamicHiddens; @property (nonatomic, assign) int loopCount; @property (nonatomic, assign) NSRange currentRange; +@property (nonatomic, assign) BOOL forwardAnimating; @property (nonatomic, assign) BOOL reversing; -@end +@end @implementation SVGAPlayer -- (instancetype)initWithFrame:(CGRect)frame -{ - self = [super initWithFrame:frame]; - if (self) { - self.contentMode = UIViewContentModeTop; +- (instancetype)init { + if (self = [super init]) { + [self initPlayer]; + } + return self; +} + +- (instancetype)initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame]) { + [self initPlayer]; + } + return self; +} + +- (instancetype)initWithCoder:(NSCoder *)aDecoder { + if (self = [super initWithCoder:aDecoder]) { + [self initPlayer]; } return self; } +- (void)initPlayer { + self.contentMode = UIViewContentModeTop; + self.clearsAfterStop = YES; +} + - (void)willMoveToSuperview:(UIView *)newSuperview { [super willMoveToSuperview:newSuperview]; if (newSuperview == nil) { @@ -46,14 +70,38 @@ - (void)willMoveToSuperview:(UIView *)newSuperview { } - (void)startAnimation { + if (self.videoItem == nil) { + NSLog(@"videoItem could not be nil!"); + return; + } else if (self.drawLayer == nil) { + self.videoItem = _videoItem; + } [self stopAnimation:NO]; self.loopCount = 0; + if (self.videoItem.FPS == 0) { + NSLog(@"videoItem FPS could not be 0!"); + return; + } self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(next)]; self.displayLink.frameInterval = 60 / self.videoItem.FPS; - [self.displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; + [self.displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:self.mainRunLoopMode]; + self.forwardAnimating = !self.reversing; } - (void)startAnimationWithRange:(NSRange)range reverse:(BOOL)reverse { + if (self.videoItem == nil) { + NSLog(@"videoItem could not be nil!"); + return; + } else if (self.drawLayer == nil) { + self.videoItem = _videoItem; + } + [self stopAnimation:NO]; + self.loopCount = 0; + if (self.videoItem.FPS == 0) { + NSLog(@"videoItem FPS could not be 0!"); + return; + } + self.currentRange = range; self.reversing = reverse; if (reverse) { @@ -62,7 +110,10 @@ - (void)startAnimationWithRange:(NSRange)range reverse:(BOOL)reverse { else { self.currentFrame = MAX(0, range.location); } - [self startAnimation]; + self.forwardAnimating = !self.reversing; + self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(next)]; + self.displayLink.frameInterval = 60 / self.videoItem.FPS; + [self.displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:self.mainRunLoopMode]; } - (void)pauseAnimation { @@ -74,21 +125,39 @@ - (void)stopAnimation { } - (void)stopAnimation:(BOOL)clear { - if (![self.displayLink isPaused]) { - [self.displayLink setPaused:YES]; - [self.displayLink removeFromRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; + self.forwardAnimating = NO; + if (self.displayLink != nil) { + [self.displayLink invalidate]; } if (clear) { [self clear]; } + [self clearAudios]; self.displayLink = nil; } - (void)clear { + self.contentLayers = nil; [self.drawLayer removeFromSuperlayer]; + self.drawLayer = nil; +} + +- (void)clearAudios { + for (SVGAAudioLayer *layer in self.audioLayers) { + if (layer.audioPlaying) { + [layer.audioPlayer stop]; + layer.audioPlaying = NO; + } + } } - (void)stepToFrame:(NSInteger)frame andPlay:(BOOL)andPlay { + if (self.videoItem == nil) { + NSLog(@"videoItem could not be nil!"); + return; + } else if (self.drawLayer == nil) { + self.videoItem = _videoItem; + } if (frame >= self.videoItem.frames || frame < 0) { return; } @@ -96,9 +165,14 @@ - (void)stepToFrame:(NSInteger)frame andPlay:(BOOL)andPlay { self.currentFrame = frame; [self update]; if (andPlay) { + self.forwardAnimating = YES; + if (self.videoItem.FPS == 0) { + NSLog(@"videoItem FPS could not be 0!"); + return; + } self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(next)]; self.displayLink.frameInterval = 60 / self.videoItem.FPS; - [self.displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; + [self.displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:self.mainRunLoopMode]; } } @@ -114,33 +188,71 @@ - (void)draw { self.drawLayer = [[CALayer alloc] init]; self.drawLayer.frame = CGRectMake(0, 0, self.videoItem.videoSize.width, self.videoItem.videoSize.height); self.drawLayer.masksToBounds = true; + NSMutableDictionary *tempHostLayers = [NSMutableDictionary dictionary]; + NSMutableArray *tempContentLayers = [NSMutableArray array]; + [self.videoItem.sprites enumerateObjectsUsingBlock:^(SVGAVideoSpriteEntity * _Nonnull sprite, NSUInteger idx, BOOL * _Nonnull stop) { UIImage *bitmap; if (sprite.imageKey != nil) { - if (self.dynamicObjects[sprite.imageKey] != nil) { - bitmap = self.dynamicObjects[sprite.imageKey]; + NSString *bitmapKey = [sprite.imageKey stringByDeletingPathExtension]; + if (self.dynamicObjects[bitmapKey] != nil) { + bitmap = self.dynamicObjects[bitmapKey]; } else { - bitmap = self.videoItem.images[sprite.imageKey]; + bitmap = self.videoItem.images[bitmapKey]; } } SVGAContentLayer *contentLayer = [sprite requestLayerWithBitmap:bitmap]; contentLayer.imageKey = sprite.imageKey; - [self.drawLayer addSublayer:contentLayer]; + [tempContentLayers addObject:contentLayer]; + if ([sprite.imageKey hasSuffix:@".matte"]) { + CALayer *hostLayer = [[CALayer alloc] init]; + hostLayer.mask = contentLayer; + tempHostLayers[sprite.imageKey] = hostLayer; + } else { + if (sprite.matteKey && sprite.matteKey.length > 0) { + CALayer *hostLayer = tempHostLayers[sprite.matteKey]; + [hostLayer addSublayer:contentLayer]; + if (![sprite.matteKey isEqualToString:self.videoItem.sprites[idx - 1].matteKey]) { + [self.drawLayer addSublayer:hostLayer]; + } + } else { + [self.drawLayer addSublayer:contentLayer]; + } + } if (sprite.imageKey != nil) { if (self.dynamicTexts[sprite.imageKey] != nil) { NSAttributedString *text = self.dynamicTexts[sprite.imageKey]; - CGSize size = [text boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:NULL].size; + CGSize bitmapSize = CGSizeMake(self.videoItem.images[sprite.imageKey].size.width * self.videoItem.images[sprite.imageKey].scale, self.videoItem.images[sprite.imageKey].size.height * self.videoItem.images[sprite.imageKey].scale); + CGSize size = [text boundingRectWithSize:bitmapSize + options:NSStringDrawingUsesLineFragmentOrigin + context:NULL].size; CATextLayer *textLayer = [CATextLayer layer]; textLayer.contentsScale = [[UIScreen mainScreen] scale]; [textLayer setString:self.dynamicTexts[sprite.imageKey]]; textLayer.frame = CGRectMake(0, 0, size.width, size.height); [contentLayer addSublayer:textLayer]; contentLayer.textLayer = textLayer; + [contentLayer resetTextLayerProperties:text]; + } + if (self.dynamicHiddens[sprite.imageKey] != nil && + [self.dynamicHiddens[sprite.imageKey] boolValue] == YES) { + contentLayer.dynamicHidden = YES; + } + if (self.dynamicDrawings[sprite.imageKey] != nil) { + contentLayer.dynamicDrawingBlock = self.dynamicDrawings[sprite.imageKey]; } } }]; + self.contentLayers = tempContentLayers; + [self.layer addSublayer:self.drawLayer]; + NSMutableArray *audioLayers = [NSMutableArray array]; + [self.videoItem.audios enumerateObjectsUsingBlock:^(SVGAAudioEntity * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + SVGAAudioLayer *audioLayer = [[SVGAAudioLayer alloc] initWithAudioItem:obj videoItem:self.videoItem]; + [audioLayers addObject:audioLayer]; + }]; + self.audioLayers = audioLayers; [self update]; [self resize]; } @@ -225,12 +337,25 @@ - (void)layoutSubviews { - (void)update { [CATransaction setDisableActions:YES]; - for (SVGAContentLayer *layer in self.drawLayer.sublayers) { + for (SVGAContentLayer *layer in self.contentLayers) { if ([layer isKindOfClass:[SVGAContentLayer class]]) { [layer stepToFrame:self.currentFrame]; } } [CATransaction setDisableActions:NO]; + if (self.forwardAnimating && self.audioLayers.count > 0) { + for (SVGAAudioLayer *layer in self.audioLayers) { + if (!layer.audioPlaying && layer.audioItem.startFrame <= self.currentFrame && self.currentFrame <= layer.audioItem.endFrame) { + [layer.audioPlayer setCurrentTime:(NSTimeInterval)(layer.audioItem.startTime / 1000)]; + [layer.audioPlayer play]; + layer.audioPlaying = YES; + } + if (layer.audioPlaying && layer.audioItem.endFrame <= self.currentFrame) { + [layer.audioPlayer stop]; + layer.audioPlaying = NO; + } + } + } } - (void)next { @@ -245,6 +370,7 @@ - (void)next { self.currentFrame++; if (self.currentFrame >= MIN(self.videoItem.frames, self.currentRange.location + self.currentRange.length)) { self.currentFrame = MAX(0, self.currentRange.location); + [self clearAudios]; self.loopCount++; } } @@ -264,11 +390,20 @@ - (void)next { } [self update]; id delegate = self.delegate; - if (delegate != nil && [delegate respondsToSelector:@selector(svgaPlayerDidAnimatedToFrame:)]) { - [delegate svgaPlayerDidAnimatedToFrame:self.currentFrame]; - } - if (delegate != nil && [delegate respondsToSelector:@selector(svgaPlayerDidAnimatedToPercentage:)] && self.videoItem.frames > 0) { - [delegate svgaPlayerDidAnimatedToPercentage:(CGFloat)(self.currentFrame + 1) / (CGFloat)self.videoItem.frames]; + if (delegate != nil) { + if ([delegate respondsToSelector:@selector(svgaPlayer:didAnimatedToFrame:)]) { + [delegate svgaPlayer:self didAnimatedToFrame:self.currentFrame]; + } else if ([delegate respondsToSelector:@selector(svgaPlayerDidAnimatedToFrame:)]){ + [delegate svgaPlayerDidAnimatedToFrame:self.currentFrame]; + } + + if (self.videoItem.frames > 0) { + if ([delegate respondsToSelector:@selector(svgaPlayer:didAnimatedToPercentage:)]) { + [delegate svgaPlayer:self didAnimatedToPercentage:(CGFloat)(self.currentFrame + 1) / (CGFloat)self.videoItem.frames]; + } else if ([delegate respondsToSelector:@selector(svgaPlayerDidAnimatedToPercentage:)]) { + [delegate svgaPlayerDidAnimatedToPercentage:(CGFloat)(self.currentFrame + 1) / (CGFloat)self.videoItem.frames]; + } + } } } @@ -277,6 +412,7 @@ - (void)setVideoItem:(SVGAVideoEntity *)videoItem { _currentRange = NSMakeRange(0, videoItem.frames); _reversing = NO; _currentFrame = 0; + _loopCount = 0; [[NSOperationQueue mainQueue] addOperationWithBlock:^{ [self clear]; [self draw]; @@ -292,8 +428,8 @@ - (void)setImage:(UIImage *)image forKey:(NSString *)aKey { NSMutableDictionary *mutableDynamicObjects = [self.dynamicObjects mutableCopy]; [mutableDynamicObjects setObject:image forKey:aKey]; self.dynamicObjects = mutableDynamicObjects; - if (self.drawLayer.sublayers.count > 0) { - for (SVGAContentLayer *layer in self.drawLayer.sublayers) { + if (self.contentLayers.count > 0) { + for (SVGAContentLayer *layer in self.contentLayers) { if ([layer isKindOfClass:[SVGAContentLayer class]] && [layer.imageKey isEqualToString:aKey]) { layer.bitmapLayer.contents = (__bridge id _Nullable)([image CGImage]); } @@ -325,15 +461,19 @@ - (void)setAttributedText:(NSAttributedString *)attributedText forKey:(NSString NSMutableDictionary *mutableDynamicTexts = [self.dynamicTexts mutableCopy]; [mutableDynamicTexts setObject:attributedText forKey:aKey]; self.dynamicTexts = mutableDynamicTexts; - if (self.drawLayer.sublayers.count > 0) { - CGSize size = [attributedText boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:NULL].size; + if (self.contentLayers.count > 0) { + CGSize bitmapSize = CGSizeMake(self.videoItem.images[aKey].size.width * self.videoItem.images[aKey].scale, self.videoItem.images[aKey].size.height * self.videoItem.images[aKey].scale); + CGSize size = [attributedText boundingRectWithSize:bitmapSize + options:NSStringDrawingUsesLineFragmentOrigin context:NULL].size; CATextLayer *textLayer; - for (SVGAContentLayer *layer in self.drawLayer.sublayers) { + for (SVGAContentLayer *layer in self.contentLayers) { if ([layer isKindOfClass:[SVGAContentLayer class]] && [layer.imageKey isEqualToString:aKey]) { textLayer = layer.textLayer; if (textLayer == nil) { textLayer = [CATextLayer layer]; [layer addSublayer:textLayer]; + layer.textLayer = textLayer; + [layer resetTextLayerProperties:attributedText]; } } } @@ -345,8 +485,39 @@ - (void)setAttributedText:(NSAttributedString *)attributedText forKey:(NSString } } +- (void)setDrawingBlock:(SVGAPlayerDynamicDrawingBlock)drawingBlock forKey:(NSString *)aKey { + NSMutableDictionary *mutableDynamicDrawings = [self.dynamicDrawings mutableCopy]; + [mutableDynamicDrawings setObject:drawingBlock forKey:aKey]; + self.dynamicDrawings = mutableDynamicDrawings; + if (self.contentLayers.count > 0) { + for (SVGAContentLayer *layer in self.contentLayers) { + if ([layer isKindOfClass:[SVGAContentLayer class]] && + [layer.imageKey isEqualToString:aKey]) { + layer.dynamicDrawingBlock = drawingBlock; + } + } + } +} + +- (void)setHidden:(BOOL)hidden forKey:(NSString *)aKey { + NSMutableDictionary *mutableDynamicHiddens = [self.dynamicHiddens mutableCopy]; + [mutableDynamicHiddens setObject:@(hidden) forKey:aKey]; + self.dynamicHiddens = mutableDynamicHiddens; + if (self.contentLayers.count > 0) { + for (SVGAContentLayer *layer in self.contentLayers) { + if ([layer isKindOfClass:[SVGAContentLayer class]] && + [layer.imageKey isEqualToString:aKey]) { + layer.dynamicHidden = hidden; + } + } + } +} + - (void)clearDynamicObjects { self.dynamicObjects = nil; + self.dynamicTexts = nil; + self.dynamicHiddens = nil; + self.dynamicDrawings = nil; } - (NSDictionary *)dynamicObjects { @@ -363,4 +534,25 @@ - (NSDictionary *)dynamicTexts { return _dynamicTexts; } +- (NSDictionary *)dynamicHiddens { + if (_dynamicHiddens == nil) { + _dynamicHiddens = @{}; + } + return _dynamicHiddens; +} + +- (NSDictionary *)dynamicDrawings { + if (_dynamicDrawings == nil) { + _dynamicDrawings = @{}; + } + return _dynamicDrawings; +} + +- (NSRunLoopMode)mainRunLoopMode { + if (!_mainRunLoopMode) { + _mainRunLoopMode = NSRunLoopCommonModes; + } + return _mainRunLoopMode; +} + @end diff --git a/Source/SVGAVectorLayer.m b/Source/SVGAVectorLayer.m index 111bb2b4..153411f9 100644 --- a/Source/SVGAVectorLayer.m +++ b/Source/SVGAVectorLayer.m @@ -55,7 +55,10 @@ - (void)stepToFrame:(NSInteger)frame { } - (BOOL)isKeepFrame:(SVGAVideoSpriteFrameEntity *)frameItem { - if ([frameItem.shapes.firstObject isKindOfClass:[NSDictionary class]]) { + if (frameItem.shapes.count == 0) { + return NO; + } + else if ([frameItem.shapes.firstObject isKindOfClass:[NSDictionary class]]) { return [frameItem.shapes.firstObject[@"type"] isKindOfClass:[NSString class]] && [frameItem.shapes.firstObject[@"type"] isEqualToString:@"keep"]; } @@ -82,7 +85,7 @@ - (void)drawFrame:(NSInteger)frame { return; } } - [self.sublayers makeObjectsPerformSelector:@selector(removeFromSuperlayer)]; + while(self.sublayers.count) [self.sublayers.firstObject removeFromSuperlayer]; for (NSDictionary *shape in frameItem.shapes) { if ([shape isKindOfClass:[NSDictionary class]]) { if ([shape[@"type"] isKindOfClass:[NSString class]]) { @@ -344,10 +347,12 @@ - (void)resetStyles:(CAShapeLayer *)shapeLayer protoShape:(SVGAProtoShapeEntity break; } shapeLayer.lineDashPhase = protoShape.styles.lineDashIii; - shapeLayer.lineDashPattern = @[ - (protoShape.styles.lineDashI < 1.0 ? @(1.0) : @(protoShape.styles.lineDashI)), - (protoShape.styles.lineDashIi < 0.1 ? @(0.1) : @(protoShape.styles.lineDashIi)) - ]; + if (protoShape.styles.lineDashI > 0.0 || protoShape.styles.lineDashIi > 0.0) { + shapeLayer.lineDashPattern = @[ + (protoShape.styles.lineDashI < 1.0 ? @(1.0) : @(protoShape.styles.lineDashI)), + (protoShape.styles.lineDashIi < 0.1 ? @(0.1) : @(protoShape.styles.lineDashIi)) + ]; + } shapeLayer.miterLimit = protoShape.styles.miterLimit; } } diff --git a/Source/SVGAVideoEntity.h b/Source/SVGAVideoEntity.h index 80405f1d..77498206 100644 --- a/Source/SVGAVideoEntity.h +++ b/Source/SVGAVideoEntity.h @@ -9,7 +9,7 @@ #import #import -@class SVGAVideoEntity, SVGAVideoSpriteEntity, SVGAVideoSpriteFrameEntity, SVGABitmapLayer, SVGAVectorLayer; +@class SVGAVideoEntity, SVGAVideoSpriteEntity, SVGAVideoSpriteFrameEntity, SVGABitmapLayer, SVGAVectorLayer, SVGAAudioEntity; @class SVGAProtoMovieEntity; @interface SVGAVideoEntity : NSObject @@ -18,7 +18,9 @@ @property (nonatomic, readonly) int FPS; @property (nonatomic, readonly) int frames; @property (nonatomic, readonly) NSDictionary *images; +@property (nonatomic, readonly) NSDictionary *audiosData; @property (nonatomic, readonly) NSArray *sprites; +@property (nonatomic, readonly) NSArray *audios; - (instancetype)initWithJSONObject:(NSDictionary *)JSONObject cacheDir:(NSString *)cacheDir; - (void)resetImagesWithJSONObject:(NSDictionary *)JSONObject; @@ -27,10 +29,13 @@ - (instancetype)initWithProtoObject:(SVGAProtoMovieEntity *)protoObject cacheDir:(NSString *)cacheDir; - (void)resetImagesWithProtoObject:(SVGAProtoMovieEntity *)protoObject; - (void)resetSpritesWithProtoObject:(SVGAProtoMovieEntity *)protoObject; +- (void)resetAudiosWithProtoObject:(SVGAProtoMovieEntity *)protoObject; + (SVGAVideoEntity *)readCache:(NSString *)cacheKey; +// NSCache缓存 - (void)saveCache:(NSString *)cacheKey; - +// NSMapTable弱缓存 +- (void)saveWeakCache:(NSString *)cacheKey; @end diff --git a/Source/SVGAVideoEntity.m b/Source/SVGAVideoEntity.m index f869c122..cd63400a 100644 --- a/Source/SVGAVideoEntity.m +++ b/Source/SVGAVideoEntity.m @@ -6,18 +6,24 @@ // Copyright © 2016年 UED Center. All rights reserved. // +#import #import "SVGAVideoEntity.h" #import "SVGABezierPath.h" #import "SVGAVideoSpriteEntity.h" +#import "SVGAAudioEntity.h" #import "Svga.pbobjc.h" +#define MP3_MAGIC_NUMBER "ID3" + @interface SVGAVideoEntity () @property (nonatomic, assign) CGSize videoSize; @property (nonatomic, assign) int FPS; @property (nonatomic, assign) int frames; @property (nonatomic, copy) NSDictionary *images; +@property (nonatomic, copy) NSDictionary *audiosData; @property (nonatomic, copy) NSArray *sprites; +@property (nonatomic, copy) NSArray *audios; @property (nonatomic, copy) NSString *cacheDir; @end @@ -25,11 +31,17 @@ @interface SVGAVideoEntity () @implementation SVGAVideoEntity static NSCache *videoCache; +static NSMapTable * weakCache; +static dispatch_semaphore_t videoSemaphore; + (void)load { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ videoCache = [[NSCache alloc] init]; + weakCache = [[NSMapTable alloc] initWithKeyOptions:NSPointerFunctionsStrongMemory + valueOptions:NSPointerFunctionsWeakMemory + capacity:64]; + videoSemaphore = dispatch_semaphore_create(1); }); } @@ -77,11 +89,12 @@ - (void)resetImagesWithJSONObject:(NSDictionary *)JSONObject { [JSONImages enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSString * _Nonnull obj, BOOL * _Nonnull stop) { if ([obj isKindOfClass:[NSString class]]) { NSString *filePath = [self.cacheDir stringByAppendingFormat:@"/%@.png", obj]; - NSData *imageData = [NSData dataWithContentsOfFile:filePath]; +// NSData *imageData = [NSData dataWithContentsOfFile:filePath]; + NSData *imageData = [NSData dataWithContentsOfFile:filePath options:NSDataReadingMappedIfSafe error:NULL]; if (imageData != nil) { UIImage *image = [[UIImage alloc] initWithData:imageData scale:2.0]; if (image != nil) { - [images setObject:image forKey:key]; + [images setObject:image forKey:[key stringByDeletingPathExtension]]; } } } @@ -127,18 +140,28 @@ - (void)resetMovieWithProtoObject:(SVGAProtoMovieEntity *)protoObject { } } ++ (BOOL)isMP3Data:(NSData *)data { + BOOL result = NO; + if (!strncmp([data bytes], MP3_MAGIC_NUMBER, strlen(MP3_MAGIC_NUMBER))) { + result = YES; + } + return result; +} + - (void)resetImagesWithProtoObject:(SVGAProtoMovieEntity *)protoObject { NSMutableDictionary *images = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *audiosData = [[NSMutableDictionary alloc] init]; NSDictionary *protoImages = [protoObject.images copy]; for (NSString *key in protoImages) { NSString *fileName = [[NSString alloc] initWithData:protoImages[key] encoding:NSUTF8StringEncoding]; if (fileName != nil) { NSString *filePath = [self.cacheDir stringByAppendingFormat:@"/%@.png", fileName]; if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) { - filePath = [self.cacheDir stringByAppendingFormat:@"/%@", fileName]; + filePath = [self.cacheDir stringByAppendingFormat:@"/%@", fileName]; } if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) { - NSData *imageData = [NSData dataWithContentsOfFile:filePath]; +// NSData *imageData = [NSData dataWithContentsOfFile:filePath]; + NSData *imageData = [NSData dataWithContentsOfFile:filePath options:NSDataReadingMappedIfSafe error:NULL]; if (imageData != nil) { UIImage *image = [[UIImage alloc] initWithData:imageData scale:2.0]; if (image != nil) { @@ -147,14 +170,20 @@ - (void)resetImagesWithProtoObject:(SVGAProtoMovieEntity *)protoObject { } } } - else { - UIImage *image = [[UIImage alloc] initWithData:protoImages[key] scale:2.0]; - if (image != nil) { - [images setObject:image forKey:key]; + else if ([protoImages[key] isKindOfClass:[NSData class]]) { + if ([SVGAVideoEntity isMP3Data:protoImages[key]]) { + // mp3 + [audiosData setObject:protoImages[key] forKey:key]; + } else { + UIImage *image = [[UIImage alloc] initWithData:protoImages[key] scale:2.0]; + if (image != nil) { + [images setObject:image forKey:key]; + } } } } self.images = images; + self.audiosData = audiosData; } - (void)resetSpritesWithProtoObject:(SVGAProtoMovieEntity *)protoObject { @@ -169,12 +198,39 @@ - (void)resetSpritesWithProtoObject:(SVGAProtoMovieEntity *)protoObject { self.sprites = sprites; } +- (void)resetAudiosWithProtoObject:(SVGAProtoMovieEntity *)protoObject { + NSMutableArray *audios = [[NSMutableArray alloc] init]; + NSArray *protoAudios = [protoObject.audiosArray copy]; + [protoAudios enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + if ([obj isKindOfClass:[SVGAProtoAudioEntity class]]) { + SVGAAudioEntity *audioItem = [[SVGAAudioEntity alloc] initWithProtoObject:obj]; + [audios addObject:audioItem]; + } + }]; + self.audios = audios; +} + + (SVGAVideoEntity *)readCache:(NSString *)cacheKey { - return [videoCache objectForKey:cacheKey]; + dispatch_semaphore_wait(videoSemaphore, DISPATCH_TIME_FOREVER); + SVGAVideoEntity * object = [videoCache objectForKey:cacheKey]; + if (!object) { + object = [weakCache objectForKey:cacheKey]; + } + dispatch_semaphore_signal(videoSemaphore); + + return object; } - (void)saveCache:(NSString *)cacheKey { + dispatch_semaphore_wait(videoSemaphore, DISPATCH_TIME_FOREVER); [videoCache setObject:self forKey:cacheKey]; + dispatch_semaphore_signal(videoSemaphore); +} + +- (void)saveWeakCache:(NSString *)cacheKey { + dispatch_semaphore_wait(videoSemaphore, DISPATCH_TIME_FOREVER); + [weakCache setObject:self forKey:cacheKey]; + dispatch_semaphore_signal(videoSemaphore); } @end @@ -183,6 +239,7 @@ @interface SVGAVideoSpriteEntity() @property (nonatomic, copy) NSString *imageKey; @property (nonatomic, copy) NSArray *frames; +@property (nonatomic, copy) NSString *matteKey; @end diff --git a/Source/SVGAVideoSpriteEntity.h b/Source/SVGAVideoSpriteEntity.h index dd9e7d72..aad7093e 100644 --- a/Source/SVGAVideoSpriteEntity.h +++ b/Source/SVGAVideoSpriteEntity.h @@ -16,6 +16,7 @@ @property (nonatomic, readonly) NSString *imageKey; @property (nonatomic, readonly) NSArray *frames; +@property (nonatomic, readonly) NSString *matteKey; - (instancetype)initWithJSONObject:(NSDictionary *)JSONObject; - (instancetype)initWithProtoObject:(SVGAProtoSpriteEntity *)protoObject; diff --git a/Source/SVGAVideoSpriteEntity.m b/Source/SVGAVideoSpriteEntity.m index ecb0c457..37b9036e 100644 --- a/Source/SVGAVideoSpriteEntity.m +++ b/Source/SVGAVideoSpriteEntity.m @@ -20,6 +20,7 @@ - (instancetype)initWithJSONObject:(NSDictionary *)JSONObject { if (self) { if ([JSONObject isKindOfClass:[NSDictionary class]]) { NSString *imageKey = JSONObject[@"imageKey"]; + NSString *matteKey = JSONObject[@"matteKey"]; NSArray *JSONFrames = JSONObject[@"frames"]; if ([imageKey isKindOfClass:[NSString class]] && [JSONFrames isKindOfClass:[NSArray class]]) { NSMutableArray *frames = [[NSMutableArray alloc] init]; @@ -30,6 +31,7 @@ - (instancetype)initWithJSONObject:(NSDictionary *)JSONObject { }]; _imageKey = imageKey; _frames = frames; + _matteKey = matteKey; } } } @@ -41,6 +43,7 @@ - (instancetype)initWithProtoObject:(SVGAProtoSpriteEntity *)protoObject { if (self) { if ([protoObject isKindOfClass:[SVGAProtoSpriteEntity class]]) { NSString *imageKey = protoObject.imageKey; + NSString *matteKey = protoObject.matteKey; NSArray *protoFrames = [protoObject.framesArray copy]; if ([imageKey isKindOfClass:[NSString class]] && [protoFrames isKindOfClass:[NSArray class]]) { NSMutableArray *frames = [[NSMutableArray alloc] init]; @@ -51,6 +54,7 @@ - (instancetype)initWithProtoObject:(SVGAProtoSpriteEntity *)protoObject { }]; _imageKey = imageKey; _frames = frames; + _matteKey = matteKey; } } } diff --git a/Source/pbobjc/Svga.pbobjc.h b/Source/pbobjc/Svga.pbobjc.h index 19b974df..9c3b8c69 100644 --- a/Source/pbobjc/Svga.pbobjc.h +++ b/Source/pbobjc/Svga.pbobjc.h @@ -4,13 +4,13 @@ // This CPP symbol can be defined to use imports that match up to the framework // imports needed when using CocoaPods. #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS) - #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0 +#define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0 #endif #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS - #import +#import #else - #import "GPBProtocolBuffers.h" +#import "GPBProtocolBuffers.h" #endif #if GOOGLE_PROTOBUF_OBJC_VERSION < 30002 @@ -27,6 +27,7 @@ CF_EXTERN_C_BEGIN +@class SVGAProtoAudioEntity; @class SVGAProtoFrameEntity; @class SVGAProtoLayout; @class SVGAProtoMovieParams; @@ -44,23 +45,23 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Enum SVGAProtoShapeEntity_ShapeType typedef GPB_ENUM(SVGAProtoShapeEntity_ShapeType) { - /** - * Value used if any message's field encounters a value that is not defined - * by this enum. The message will also have C functions to get/set the rawValue - * of the field. - **/ - SVGAProtoShapeEntity_ShapeType_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, - /** 路径 */ - SVGAProtoShapeEntity_ShapeType_Shape = 0, - - /** 矩形 */ - SVGAProtoShapeEntity_ShapeType_Rect = 1, - - /** 圆形 */ - SVGAProtoShapeEntity_ShapeType_Ellipse = 2, - - /** 与前帧一致 */ - SVGAProtoShapeEntity_ShapeType_Keep = 3, + /** + * Value used if any message's field encounters a value that is not defined + * by this enum. The message will also have C functions to get/set the rawValue + * of the field. + **/ + SVGAProtoShapeEntity_ShapeType_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, + /** 路径 */ + SVGAProtoShapeEntity_ShapeType_Shape = 0, + + /** 矩形 */ + SVGAProtoShapeEntity_ShapeType_Rect = 1, + + /** 圆形 */ + SVGAProtoShapeEntity_ShapeType_Ellipse = 2, + + /** 与前帧一致 */ + SVGAProtoShapeEntity_ShapeType_Keep = 3, }; GPBEnumDescriptor *SVGAProtoShapeEntity_ShapeType_EnumDescriptor(void); @@ -74,15 +75,15 @@ BOOL SVGAProtoShapeEntity_ShapeType_IsValidValue(int32_t value); #pragma mark - Enum SVGAProtoShapeEntity_ShapeStyle_LineCap typedef GPB_ENUM(SVGAProtoShapeEntity_ShapeStyle_LineCap) { - /** - * Value used if any message's field encounters a value that is not defined - * by this enum. The message will also have C functions to get/set the rawValue - * of the field. - **/ - SVGAProtoShapeEntity_ShapeStyle_LineCap_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, - SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapButt = 0, - SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapRound = 1, - SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapSquare = 2, + /** + * Value used if any message's field encounters a value that is not defined + * by this enum. The message will also have C functions to get/set the rawValue + * of the field. + **/ + SVGAProtoShapeEntity_ShapeStyle_LineCap_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, + SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapButt = 0, + SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapRound = 1, + SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapSquare = 2, }; GPBEnumDescriptor *SVGAProtoShapeEntity_ShapeStyle_LineCap_EnumDescriptor(void); @@ -96,15 +97,15 @@ BOOL SVGAProtoShapeEntity_ShapeStyle_LineCap_IsValidValue(int32_t value); #pragma mark - Enum SVGAProtoShapeEntity_ShapeStyle_LineJoin typedef GPB_ENUM(SVGAProtoShapeEntity_ShapeStyle_LineJoin) { - /** - * Value used if any message's field encounters a value that is not defined - * by this enum. The message will also have C functions to get/set the rawValue - * of the field. - **/ - SVGAProtoShapeEntity_ShapeStyle_LineJoin_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, - SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinMiter = 0, - SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinRound = 1, - SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinBevel = 2, + /** + * Value used if any message's field encounters a value that is not defined + * by this enum. The message will also have C functions to get/set the rawValue + * of the field. + **/ + SVGAProtoShapeEntity_ShapeStyle_LineJoin_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, + SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinMiter = 0, + SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinRound = 1, + SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinBevel = 2, }; GPBEnumDescriptor *SVGAProtoShapeEntity_ShapeStyle_LineJoin_EnumDescriptor(void); @@ -133,10 +134,10 @@ BOOL SVGAProtoShapeEntity_ShapeStyle_LineJoin_IsValidValue(int32_t value); #pragma mark - SVGAProtoMovieParams typedef GPB_ENUM(SVGAProtoMovieParams_FieldNumber) { - SVGAProtoMovieParams_FieldNumber_ViewBoxWidth = 1, - SVGAProtoMovieParams_FieldNumber_ViewBoxHeight = 2, - SVGAProtoMovieParams_FieldNumber_Fps = 3, - SVGAProtoMovieParams_FieldNumber_Frames = 4, + SVGAProtoMovieParams_FieldNumber_ViewBoxWidth = 1, + SVGAProtoMovieParams_FieldNumber_ViewBoxHeight = 2, + SVGAProtoMovieParams_FieldNumber_Fps = 3, + SVGAProtoMovieParams_FieldNumber_Frames = 4, }; @interface SVGAProtoMovieParams : GPBMessage @@ -158,13 +159,14 @@ typedef GPB_ENUM(SVGAProtoMovieParams_FieldNumber) { #pragma mark - SVGAProtoSpriteEntity typedef GPB_ENUM(SVGAProtoSpriteEntity_FieldNumber) { - SVGAProtoSpriteEntity_FieldNumber_ImageKey = 1, - SVGAProtoSpriteEntity_FieldNumber_FramesArray = 2, + SVGAProtoSpriteEntity_FieldNumber_ImageKey = 1, + SVGAProtoSpriteEntity_FieldNumber_FramesArray = 2, + SVGAProtoSpriteEntity_FieldNumber_MatteKey = 3, }; @interface SVGAProtoSpriteEntity : GPBMessage -/** 元件所对应的位图键名, 如果 imageKey 含有 .vector 后缀,该 sprite 为矢量图层。 */ +/** 元件所对应的位图键名, 如果 imageKey 含有 .vector 后缀,该 sprite 为矢量图层 含有 .matte 后缀,该 sprite 为遮罩图层。 */ @property(nonatomic, readwrite, copy, null_resettable) NSString *imageKey; /** 帧列表 */ @@ -172,15 +174,47 @@ typedef GPB_ENUM(SVGAProtoSpriteEntity_FieldNumber) { /** The number of items in @c framesArray without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger framesArray_Count; +/** 被遮罩图层的 matteKey 对应的是其遮罩图层的 imageKey. */ +@property(nonatomic, readwrite, copy, null_resettable) NSString *matteKey; + +@end + +#pragma mark - SVGAProtoAudioEntity + +typedef GPB_ENUM(SVGAProtoAudioEntity_FieldNumber) { + SVGAProtoAudioEntity_FieldNumber_AudioKey = 1, + SVGAProtoAudioEntity_FieldNumber_StartFrame = 2, + SVGAProtoAudioEntity_FieldNumber_EndFrame = 3, + SVGAProtoAudioEntity_FieldNumber_StartTime = 4, + SVGAProtoAudioEntity_FieldNumber_TotalTime = 5, +}; + +@interface SVGAProtoAudioEntity : GPBMessage + +/** 音频文件名 */ +@property(nonatomic, readwrite, copy, null_resettable) NSString *audioKey; + +/** 音频播放起始帧 */ +@property(nonatomic, readwrite) int32_t startFrame; + +/** 音频播放结束帧 */ +@property(nonatomic, readwrite) int32_t endFrame; + +/** 音频播放起始时间(相对音频长度) */ +@property(nonatomic, readwrite) int32_t startTime; + +/** 音频总长度 */ +@property(nonatomic, readwrite) int32_t totalTime; + @end #pragma mark - SVGAProtoLayout typedef GPB_ENUM(SVGAProtoLayout_FieldNumber) { - SVGAProtoLayout_FieldNumber_X = 1, - SVGAProtoLayout_FieldNumber_Y = 2, - SVGAProtoLayout_FieldNumber_Width = 3, - SVGAProtoLayout_FieldNumber_Height = 4, + SVGAProtoLayout_FieldNumber_X = 1, + SVGAProtoLayout_FieldNumber_Y = 2, + SVGAProtoLayout_FieldNumber_Width = 3, + SVGAProtoLayout_FieldNumber_Height = 4, }; @interface SVGAProtoLayout : GPBMessage @@ -198,12 +232,12 @@ typedef GPB_ENUM(SVGAProtoLayout_FieldNumber) { #pragma mark - SVGAProtoTransform typedef GPB_ENUM(SVGAProtoTransform_FieldNumber) { - SVGAProtoTransform_FieldNumber_A = 1, - SVGAProtoTransform_FieldNumber_B = 2, - SVGAProtoTransform_FieldNumber_C = 3, - SVGAProtoTransform_FieldNumber_D = 4, - SVGAProtoTransform_FieldNumber_Tx = 5, - SVGAProtoTransform_FieldNumber_Ty = 6, + SVGAProtoTransform_FieldNumber_A = 1, + SVGAProtoTransform_FieldNumber_B = 2, + SVGAProtoTransform_FieldNumber_C = 3, + SVGAProtoTransform_FieldNumber_D = 4, + SVGAProtoTransform_FieldNumber_Tx = 5, + SVGAProtoTransform_FieldNumber_Ty = 6, }; @interface SVGAProtoTransform : GPBMessage @@ -225,19 +259,19 @@ typedef GPB_ENUM(SVGAProtoTransform_FieldNumber) { #pragma mark - SVGAProtoShapeEntity typedef GPB_ENUM(SVGAProtoShapeEntity_FieldNumber) { - SVGAProtoShapeEntity_FieldNumber_Type = 1, - SVGAProtoShapeEntity_FieldNumber_Shape = 2, - SVGAProtoShapeEntity_FieldNumber_Rect = 3, - SVGAProtoShapeEntity_FieldNumber_Ellipse = 4, - SVGAProtoShapeEntity_FieldNumber_Styles = 10, - SVGAProtoShapeEntity_FieldNumber_Transform = 11, + SVGAProtoShapeEntity_FieldNumber_Type = 1, + SVGAProtoShapeEntity_FieldNumber_Shape = 2, + SVGAProtoShapeEntity_FieldNumber_Rect = 3, + SVGAProtoShapeEntity_FieldNumber_Ellipse = 4, + SVGAProtoShapeEntity_FieldNumber_Styles = 10, + SVGAProtoShapeEntity_FieldNumber_Transform = 11, }; typedef GPB_ENUM(SVGAProtoShapeEntity_Args_OneOfCase) { - SVGAProtoShapeEntity_Args_OneOfCase_GPBUnsetOneOfCase = 0, - SVGAProtoShapeEntity_Args_OneOfCase_Shape = 2, - SVGAProtoShapeEntity_Args_OneOfCase_Rect = 3, - SVGAProtoShapeEntity_Args_OneOfCase_Ellipse = 4, + SVGAProtoShapeEntity_Args_OneOfCase_GPBUnsetOneOfCase = 0, + SVGAProtoShapeEntity_Args_OneOfCase_Shape = 2, + SVGAProtoShapeEntity_Args_OneOfCase_Rect = 3, + SVGAProtoShapeEntity_Args_OneOfCase_Ellipse = 4, }; @interface SVGAProtoShapeEntity : GPBMessage @@ -285,7 +319,7 @@ void SVGAProtoShapeEntity_ClearArgsOneOfCase(SVGAProtoShapeEntity *message); #pragma mark - SVGAProtoShapeEntity_ShapeArgs typedef GPB_ENUM(SVGAProtoShapeEntity_ShapeArgs_FieldNumber) { - SVGAProtoShapeEntity_ShapeArgs_FieldNumber_D = 1, + SVGAProtoShapeEntity_ShapeArgs_FieldNumber_D = 1, }; @interface SVGAProtoShapeEntity_ShapeArgs : GPBMessage @@ -298,11 +332,11 @@ typedef GPB_ENUM(SVGAProtoShapeEntity_ShapeArgs_FieldNumber) { #pragma mark - SVGAProtoShapeEntity_RectArgs typedef GPB_ENUM(SVGAProtoShapeEntity_RectArgs_FieldNumber) { - SVGAProtoShapeEntity_RectArgs_FieldNumber_X = 1, - SVGAProtoShapeEntity_RectArgs_FieldNumber_Y = 2, - SVGAProtoShapeEntity_RectArgs_FieldNumber_Width = 3, - SVGAProtoShapeEntity_RectArgs_FieldNumber_Height = 4, - SVGAProtoShapeEntity_RectArgs_FieldNumber_CornerRadius = 5, + SVGAProtoShapeEntity_RectArgs_FieldNumber_X = 1, + SVGAProtoShapeEntity_RectArgs_FieldNumber_Y = 2, + SVGAProtoShapeEntity_RectArgs_FieldNumber_Width = 3, + SVGAProtoShapeEntity_RectArgs_FieldNumber_Height = 4, + SVGAProtoShapeEntity_RectArgs_FieldNumber_CornerRadius = 5, }; @interface SVGAProtoShapeEntity_RectArgs : GPBMessage @@ -323,10 +357,10 @@ typedef GPB_ENUM(SVGAProtoShapeEntity_RectArgs_FieldNumber) { #pragma mark - SVGAProtoShapeEntity_EllipseArgs typedef GPB_ENUM(SVGAProtoShapeEntity_EllipseArgs_FieldNumber) { - SVGAProtoShapeEntity_EllipseArgs_FieldNumber_X = 1, - SVGAProtoShapeEntity_EllipseArgs_FieldNumber_Y = 2, - SVGAProtoShapeEntity_EllipseArgs_FieldNumber_RadiusX = 3, - SVGAProtoShapeEntity_EllipseArgs_FieldNumber_RadiusY = 4, + SVGAProtoShapeEntity_EllipseArgs_FieldNumber_X = 1, + SVGAProtoShapeEntity_EllipseArgs_FieldNumber_Y = 2, + SVGAProtoShapeEntity_EllipseArgs_FieldNumber_RadiusX = 3, + SVGAProtoShapeEntity_EllipseArgs_FieldNumber_RadiusY = 4, }; @interface SVGAProtoShapeEntity_EllipseArgs : GPBMessage @@ -348,15 +382,15 @@ typedef GPB_ENUM(SVGAProtoShapeEntity_EllipseArgs_FieldNumber) { #pragma mark - SVGAProtoShapeEntity_ShapeStyle typedef GPB_ENUM(SVGAProtoShapeEntity_ShapeStyle_FieldNumber) { - SVGAProtoShapeEntity_ShapeStyle_FieldNumber_Fill = 1, - SVGAProtoShapeEntity_ShapeStyle_FieldNumber_Stroke = 2, - SVGAProtoShapeEntity_ShapeStyle_FieldNumber_StrokeWidth = 3, - SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineCap = 4, - SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineJoin = 5, - SVGAProtoShapeEntity_ShapeStyle_FieldNumber_MiterLimit = 6, - SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineDashI = 7, - SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineDashIi = 8, - SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineDashIii = 9, + SVGAProtoShapeEntity_ShapeStyle_FieldNumber_Fill = 1, + SVGAProtoShapeEntity_ShapeStyle_FieldNumber_Stroke = 2, + SVGAProtoShapeEntity_ShapeStyle_FieldNumber_StrokeWidth = 3, + SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineCap = 4, + SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineJoin = 5, + SVGAProtoShapeEntity_ShapeStyle_FieldNumber_MiterLimit = 6, + SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineDashI = 7, + SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineDashIi = 8, + SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineDashIii = 9, }; @interface SVGAProtoShapeEntity_ShapeStyle : GPBMessage @@ -421,10 +455,10 @@ void SetSVGAProtoShapeEntity_ShapeStyle_LineJoin_RawValue(SVGAProtoShapeEntity_S #pragma mark - SVGAProtoShapeEntity_ShapeStyle_RGBAColor typedef GPB_ENUM(SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber) { - SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_R = 1, - SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_G = 2, - SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_B = 3, - SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_A = 4, + SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_R = 1, + SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_G = 2, + SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_B = 3, + SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_A = 4, }; @interface SVGAProtoShapeEntity_ShapeStyle_RGBAColor : GPBMessage @@ -442,11 +476,11 @@ typedef GPB_ENUM(SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber) { #pragma mark - SVGAProtoFrameEntity typedef GPB_ENUM(SVGAProtoFrameEntity_FieldNumber) { - SVGAProtoFrameEntity_FieldNumber_Alpha = 1, - SVGAProtoFrameEntity_FieldNumber_Layout = 2, - SVGAProtoFrameEntity_FieldNumber_Transform = 3, - SVGAProtoFrameEntity_FieldNumber_ClipPath = 4, - SVGAProtoFrameEntity_FieldNumber_ShapesArray = 5, + SVGAProtoFrameEntity_FieldNumber_Alpha = 1, + SVGAProtoFrameEntity_FieldNumber_Layout = 2, + SVGAProtoFrameEntity_FieldNumber_Transform = 3, + SVGAProtoFrameEntity_FieldNumber_ClipPath = 4, + SVGAProtoFrameEntity_FieldNumber_ShapesArray = 5, }; @interface SVGAProtoFrameEntity : GPBMessage @@ -477,10 +511,11 @@ typedef GPB_ENUM(SVGAProtoFrameEntity_FieldNumber) { #pragma mark - SVGAProtoMovieEntity typedef GPB_ENUM(SVGAProtoMovieEntity_FieldNumber) { - SVGAProtoMovieEntity_FieldNumber_Version = 1, - SVGAProtoMovieEntity_FieldNumber_Params = 2, - SVGAProtoMovieEntity_FieldNumber_Images = 3, - SVGAProtoMovieEntity_FieldNumber_SpritesArray = 4, + SVGAProtoMovieEntity_FieldNumber_Version = 1, + SVGAProtoMovieEntity_FieldNumber_Params = 2, + SVGAProtoMovieEntity_FieldNumber_Images = 3, + SVGAProtoMovieEntity_FieldNumber_SpritesArray = 4, + SVGAProtoMovieEntity_FieldNumber_AudiosArray = 5, }; @interface SVGAProtoMovieEntity : GPBMessage @@ -503,6 +538,11 @@ typedef GPB_ENUM(SVGAProtoMovieEntity_FieldNumber) { /** The number of items in @c spritesArray without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger spritesArray_Count; +/** 音频列表 */ +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *audiosArray; +/** The number of items in @c audiosArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger audiosArray_Count; + @end NS_ASSUME_NONNULL_END diff --git a/Source/pbobjc/Svga.pbobjc.m b/Source/pbobjc/Svga.pbobjc.m index e517c431..3fd8e4d7 100644 --- a/Source/pbobjc/Svga.pbobjc.m +++ b/Source/pbobjc/Svga.pbobjc.m @@ -4,16 +4,16 @@ // This CPP symbol can be defined to use imports that match up to the framework // imports needed when using CocoaPods. #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS) - #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0 +#define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0 #endif #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS - #import +#import #else - #import "GPBProtocolBuffers_RuntimeSupport.h" +#import "GPBProtocolBuffers_RuntimeSupport.h" #endif - #import "Svga.pbobjc.h" +#import "Svga.pbobjc.h" // @@protoc_insertion_point(imports) #pragma clang diagnostic push @@ -32,16 +32,16 @@ @implementation SVGAProtoSvgaRoot #pragma mark - SVGAProtoSvgaRoot_FileDescriptor static GPBFileDescriptor *SVGAProtoSvgaRoot_FileDescriptor(void) { - // This is called by +initialize so there is no need to worry - // about thread safety of the singleton. - static GPBFileDescriptor *descriptor = NULL; - if (!descriptor) { - GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); - descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"com.opensource.svga" - objcPrefix:@"SVGAProto" - syntax:GPBFileSyntaxProto3]; - } - return descriptor; + // This is called by +initialize so there is no need to worry + // about thread safety of the singleton. + static GPBFileDescriptor *descriptor = NULL; + if (!descriptor) { + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); + descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"com.opensource.svga" + objcPrefix:@"SVGAProto" + syntax:GPBFileSyntaxProto3]; + } + return descriptor; } #pragma mark - SVGAProtoMovieParams @@ -54,57 +54,57 @@ @implementation SVGAProtoMovieParams @dynamic frames; typedef struct SVGAProtoMovieParams__storage_ { - uint32_t _has_storage_[1]; - float viewBoxWidth; - float viewBoxHeight; - int32_t fps; - int32_t frames; + uint32_t _has_storage_[1]; + float viewBoxWidth; + float viewBoxHeight; + int32_t fps; + int32_t frames; } SVGAProtoMovieParams__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. + (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "viewBoxWidth", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoMovieParams_FieldNumber_ViewBoxWidth, - .hasIndex = 0, - .offset = (uint32_t)offsetof(SVGAProtoMovieParams__storage_, viewBoxWidth), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), - .dataType = GPBDataTypeFloat, - }, - { - .name = "viewBoxHeight", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoMovieParams_FieldNumber_ViewBoxHeight, - .hasIndex = 1, - .offset = (uint32_t)offsetof(SVGAProtoMovieParams__storage_, viewBoxHeight), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), - .dataType = GPBDataTypeFloat, - }, - { - .name = "fps", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoMovieParams_FieldNumber_Fps, - .hasIndex = 2, - .offset = (uint32_t)offsetof(SVGAProtoMovieParams__storage_, fps), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeInt32, - }, - { - .name = "frames", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoMovieParams_FieldNumber_Frames, - .hasIndex = 3, - .offset = (uint32_t)offsetof(SVGAProtoMovieParams__storage_, frames), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeInt32, - }, - }; - GPBDescriptor *localDescriptor = + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "viewBoxWidth", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoMovieParams_FieldNumber_ViewBoxWidth, + .hasIndex = 0, + .offset = (uint32_t)offsetof(SVGAProtoMovieParams__storage_, viewBoxWidth), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeFloat, + }, + { + .name = "viewBoxHeight", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoMovieParams_FieldNumber_ViewBoxHeight, + .hasIndex = 1, + .offset = (uint32_t)offsetof(SVGAProtoMovieParams__storage_, viewBoxHeight), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeFloat, + }, + { + .name = "fps", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoMovieParams_FieldNumber_Fps, + .hasIndex = 2, + .offset = (uint32_t)offsetof(SVGAProtoMovieParams__storage_, fps), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeInt32, + }, + { + .name = "frames", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoMovieParams_FieldNumber_Frames, + .hasIndex = 3, + .offset = (uint32_t)offsetof(SVGAProtoMovieParams__storage_, frames), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeInt32, + }, + }; + GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[SVGAProtoMovieParams class] rootClass:[SVGAProtoSvgaRoot class] file:SVGAProtoSvgaRoot_FileDescriptor() @@ -113,14 +113,14 @@ + (GPBDescriptor *)descriptor { storageSize:sizeof(SVGAProtoMovieParams__storage_) flags:GPBDescriptorInitializationFlag_None]; #if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS - static const char *extraTextFormatInfo = + static const char *extraTextFormatInfo = "\002\001\014\000\002\r\000"; - [localDescriptor setupExtraTextInfo:extraTextFormatInfo]; + [localDescriptor setupExtraTextInfo:extraTextFormatInfo]; #endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS - NSAssert(descriptor == nil, @"Startup recursed!"); - descriptor = localDescriptor; - } - return descriptor; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; } @end @@ -131,39 +131,50 @@ @implementation SVGAProtoSpriteEntity @dynamic imageKey; @dynamic framesArray, framesArray_Count; +@dynamic matteKey; typedef struct SVGAProtoSpriteEntity__storage_ { - uint32_t _has_storage_[1]; - NSString *imageKey; - NSMutableArray *framesArray; + uint32_t _has_storage_[1]; + NSString *imageKey; + NSMutableArray *framesArray; + NSString *matteKey; } SVGAProtoSpriteEntity__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. + (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "imageKey", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoSpriteEntity_FieldNumber_ImageKey, - .hasIndex = 0, - .offset = (uint32_t)offsetof(SVGAProtoSpriteEntity__storage_, imageKey), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), - .dataType = GPBDataTypeString, - }, - { - .name = "framesArray", - .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoFrameEntity), - .number = SVGAProtoSpriteEntity_FieldNumber_FramesArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(SVGAProtoSpriteEntity__storage_, framesArray), - .flags = GPBFieldRepeated, - .dataType = GPBDataTypeMessage, - }, - }; - GPBDescriptor *localDescriptor = + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "imageKey", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoSpriteEntity_FieldNumber_ImageKey, + .hasIndex = 0, + .offset = (uint32_t)offsetof(SVGAProtoSpriteEntity__storage_, imageKey), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeString, + }, + { + .name = "framesArray", + .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoFrameEntity), + .number = SVGAProtoSpriteEntity_FieldNumber_FramesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(SVGAProtoSpriteEntity__storage_, framesArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + { + .name = "matteKey", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoSpriteEntity_FieldNumber_MatteKey, + .hasIndex = 1, + .offset = (uint32_t)offsetof(SVGAProtoSpriteEntity__storage_, matteKey), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeString, + }, + }; + GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[SVGAProtoSpriteEntity class] rootClass:[SVGAProtoSvgaRoot class] file:SVGAProtoSvgaRoot_FileDescriptor() @@ -172,14 +183,106 @@ + (GPBDescriptor *)descriptor { storageSize:sizeof(SVGAProtoSpriteEntity__storage_) flags:GPBDescriptorInitializationFlag_None]; #if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS - static const char *extraTextFormatInfo = - "\001\001\010\000"; - [localDescriptor setupExtraTextInfo:extraTextFormatInfo]; + static const char *extraTextFormatInfo = + "\002\001\010\000\003\010\000"; + [localDescriptor setupExtraTextInfo:extraTextFormatInfo]; #endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS - NSAssert(descriptor == nil, @"Startup recursed!"); - descriptor = localDescriptor; - } - return descriptor; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - SVGAProtoAudioEntity + +@implementation SVGAProtoAudioEntity + +@dynamic audioKey; +@dynamic startFrame; +@dynamic endFrame; +@dynamic startTime; +@dynamic totalTime; + +typedef struct SVGAProtoAudioEntity__storage_ { + uint32_t _has_storage_[1]; + int32_t startFrame; + int32_t endFrame; + int32_t startTime; + int32_t totalTime; + NSString *audioKey; +} SVGAProtoAudioEntity__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "audioKey", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoAudioEntity_FieldNumber_AudioKey, + .hasIndex = 0, + .offset = (uint32_t)offsetof(SVGAProtoAudioEntity__storage_, audioKey), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeString, + }, + { + .name = "startFrame", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoAudioEntity_FieldNumber_StartFrame, + .hasIndex = 1, + .offset = (uint32_t)offsetof(SVGAProtoAudioEntity__storage_, startFrame), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeInt32, + }, + { + .name = "endFrame", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoAudioEntity_FieldNumber_EndFrame, + .hasIndex = 2, + .offset = (uint32_t)offsetof(SVGAProtoAudioEntity__storage_, endFrame), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeInt32, + }, + { + .name = "startTime", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoAudioEntity_FieldNumber_StartTime, + .hasIndex = 3, + .offset = (uint32_t)offsetof(SVGAProtoAudioEntity__storage_, startTime), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeInt32, + }, + { + .name = "totalTime", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoAudioEntity_FieldNumber_TotalTime, + .hasIndex = 4, + .offset = (uint32_t)offsetof(SVGAProtoAudioEntity__storage_, totalTime), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeInt32, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[SVGAProtoAudioEntity class] + rootClass:[SVGAProtoSvgaRoot class] + file:SVGAProtoSvgaRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(SVGAProtoAudioEntity__storage_) + flags:GPBDescriptorInitializationFlag_None]; +#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS + static const char *extraTextFormatInfo = + "\005\001\010\000\002\n\000\003\010\000\004\t\000\005\t\000"; + [localDescriptor setupExtraTextInfo:extraTextFormatInfo]; +#endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; } @end @@ -194,57 +297,57 @@ @implementation SVGAProtoLayout @dynamic height; typedef struct SVGAProtoLayout__storage_ { - uint32_t _has_storage_[1]; - float x; - float y; - float width; - float height; + uint32_t _has_storage_[1]; + float x; + float y; + float width; + float height; } SVGAProtoLayout__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. + (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "x", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoLayout_FieldNumber_X, - .hasIndex = 0, - .offset = (uint32_t)offsetof(SVGAProtoLayout__storage_, x), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "y", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoLayout_FieldNumber_Y, - .hasIndex = 1, - .offset = (uint32_t)offsetof(SVGAProtoLayout__storage_, y), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "width", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoLayout_FieldNumber_Width, - .hasIndex = 2, - .offset = (uint32_t)offsetof(SVGAProtoLayout__storage_, width), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "height", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoLayout_FieldNumber_Height, - .hasIndex = 3, - .offset = (uint32_t)offsetof(SVGAProtoLayout__storage_, height), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - }; - GPBDescriptor *localDescriptor = + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "x", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoLayout_FieldNumber_X, + .hasIndex = 0, + .offset = (uint32_t)offsetof(SVGAProtoLayout__storage_, x), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "y", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoLayout_FieldNumber_Y, + .hasIndex = 1, + .offset = (uint32_t)offsetof(SVGAProtoLayout__storage_, y), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "width", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoLayout_FieldNumber_Width, + .hasIndex = 2, + .offset = (uint32_t)offsetof(SVGAProtoLayout__storage_, width), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "height", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoLayout_FieldNumber_Height, + .hasIndex = 3, + .offset = (uint32_t)offsetof(SVGAProtoLayout__storage_, height), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + }; + GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[SVGAProtoLayout class] rootClass:[SVGAProtoSvgaRoot class] file:SVGAProtoSvgaRoot_FileDescriptor() @@ -252,10 +355,10 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(SVGAProtoLayout__storage_) flags:GPBDescriptorInitializationFlag_None]; - NSAssert(descriptor == nil, @"Startup recursed!"); - descriptor = localDescriptor; - } - return descriptor; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; } @end @@ -272,77 +375,77 @@ @implementation SVGAProtoTransform @dynamic ty; typedef struct SVGAProtoTransform__storage_ { - uint32_t _has_storage_[1]; - float a; - float b; - float c; - float d; - float tx; - float ty; + uint32_t _has_storage_[1]; + float a; + float b; + float c; + float d; + float tx; + float ty; } SVGAProtoTransform__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. + (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "a", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoTransform_FieldNumber_A, - .hasIndex = 0, - .offset = (uint32_t)offsetof(SVGAProtoTransform__storage_, a), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "b", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoTransform_FieldNumber_B, - .hasIndex = 1, - .offset = (uint32_t)offsetof(SVGAProtoTransform__storage_, b), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "c", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoTransform_FieldNumber_C, - .hasIndex = 2, - .offset = (uint32_t)offsetof(SVGAProtoTransform__storage_, c), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "d", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoTransform_FieldNumber_D, - .hasIndex = 3, - .offset = (uint32_t)offsetof(SVGAProtoTransform__storage_, d), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "tx", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoTransform_FieldNumber_Tx, - .hasIndex = 4, - .offset = (uint32_t)offsetof(SVGAProtoTransform__storage_, tx), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "ty", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoTransform_FieldNumber_Ty, - .hasIndex = 5, - .offset = (uint32_t)offsetof(SVGAProtoTransform__storage_, ty), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - }; - GPBDescriptor *localDescriptor = + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "a", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoTransform_FieldNumber_A, + .hasIndex = 0, + .offset = (uint32_t)offsetof(SVGAProtoTransform__storage_, a), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "b", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoTransform_FieldNumber_B, + .hasIndex = 1, + .offset = (uint32_t)offsetof(SVGAProtoTransform__storage_, b), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "c", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoTransform_FieldNumber_C, + .hasIndex = 2, + .offset = (uint32_t)offsetof(SVGAProtoTransform__storage_, c), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "d", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoTransform_FieldNumber_D, + .hasIndex = 3, + .offset = (uint32_t)offsetof(SVGAProtoTransform__storage_, d), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "tx", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoTransform_FieldNumber_Tx, + .hasIndex = 4, + .offset = (uint32_t)offsetof(SVGAProtoTransform__storage_, tx), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "ty", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoTransform_FieldNumber_Ty, + .hasIndex = 5, + .offset = (uint32_t)offsetof(SVGAProtoTransform__storage_, ty), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + }; + GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[SVGAProtoTransform class] rootClass:[SVGAProtoSvgaRoot class] file:SVGAProtoSvgaRoot_FileDescriptor() @@ -350,10 +453,10 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(SVGAProtoTransform__storage_) flags:GPBDescriptorInitializationFlag_None]; - NSAssert(descriptor == nil, @"Startup recursed!"); - descriptor = localDescriptor; - } - return descriptor; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; } @end @@ -371,77 +474,77 @@ @implementation SVGAProtoShapeEntity @dynamic hasTransform, transform; typedef struct SVGAProtoShapeEntity__storage_ { - uint32_t _has_storage_[2]; - SVGAProtoShapeEntity_ShapeType type; - SVGAProtoShapeEntity_ShapeArgs *shape; - SVGAProtoShapeEntity_RectArgs *rect; - SVGAProtoShapeEntity_EllipseArgs *ellipse; - SVGAProtoShapeEntity_ShapeStyle *styles; - SVGAProtoTransform *transform; + uint32_t _has_storage_[2]; + SVGAProtoShapeEntity_ShapeType type; + SVGAProtoShapeEntity_ShapeArgs *shape; + SVGAProtoShapeEntity_RectArgs *rect; + SVGAProtoShapeEntity_EllipseArgs *ellipse; + SVGAProtoShapeEntity_ShapeStyle *styles; + SVGAProtoTransform *transform; } SVGAProtoShapeEntity__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. + (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "type", - .dataTypeSpecific.enumDescFunc = SVGAProtoShapeEntity_ShapeType_EnumDescriptor, - .number = SVGAProtoShapeEntity_FieldNumber_Type, - .hasIndex = 0, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity__storage_, type), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor), - .dataType = GPBDataTypeEnum, - }, - { - .name = "shape", - .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoShapeEntity_ShapeArgs), - .number = SVGAProtoShapeEntity_FieldNumber_Shape, - .hasIndex = -1, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity__storage_, shape), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "rect", - .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoShapeEntity_RectArgs), - .number = SVGAProtoShapeEntity_FieldNumber_Rect, - .hasIndex = -1, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity__storage_, rect), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "ellipse", - .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoShapeEntity_EllipseArgs), - .number = SVGAProtoShapeEntity_FieldNumber_Ellipse, - .hasIndex = -1, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity__storage_, ellipse), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "styles", - .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoShapeEntity_ShapeStyle), - .number = SVGAProtoShapeEntity_FieldNumber_Styles, - .hasIndex = 1, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity__storage_, styles), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "transform", - .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoTransform), - .number = SVGAProtoShapeEntity_FieldNumber_Transform, - .hasIndex = 2, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity__storage_, transform), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - }; - GPBDescriptor *localDescriptor = + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "type", + .dataTypeSpecific.enumDescFunc = SVGAProtoShapeEntity_ShapeType_EnumDescriptor, + .number = SVGAProtoShapeEntity_FieldNumber_Type, + .hasIndex = 0, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity__storage_, type), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor), + .dataType = GPBDataTypeEnum, + }, + { + .name = "shape", + .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoShapeEntity_ShapeArgs), + .number = SVGAProtoShapeEntity_FieldNumber_Shape, + .hasIndex = -1, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity__storage_, shape), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "rect", + .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoShapeEntity_RectArgs), + .number = SVGAProtoShapeEntity_FieldNumber_Rect, + .hasIndex = -1, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity__storage_, rect), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "ellipse", + .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoShapeEntity_EllipseArgs), + .number = SVGAProtoShapeEntity_FieldNumber_Ellipse, + .hasIndex = -1, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity__storage_, ellipse), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "styles", + .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoShapeEntity_ShapeStyle), + .number = SVGAProtoShapeEntity_FieldNumber_Styles, + .hasIndex = 1, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity__storage_, styles), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "transform", + .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoTransform), + .number = SVGAProtoShapeEntity_FieldNumber_Transform, + .hasIndex = 2, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity__storage_, transform), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[SVGAProtoShapeEntity class] rootClass:[SVGAProtoSvgaRoot class] file:SVGAProtoSvgaRoot_FileDescriptor() @@ -449,73 +552,73 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(SVGAProtoShapeEntity__storage_) flags:GPBDescriptorInitializationFlag_None]; - static const char *oneofs[] = { - "args", - }; - [localDescriptor setupOneofs:oneofs - count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) - firstHasIndex:-1]; - NSAssert(descriptor == nil, @"Startup recursed!"); - descriptor = localDescriptor; - } - return descriptor; + static const char *oneofs[] = { + "args", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; } @end int32_t SVGAProtoShapeEntity_Type_RawValue(SVGAProtoShapeEntity *message) { - GPBDescriptor *descriptor = [SVGAProtoShapeEntity descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:SVGAProtoShapeEntity_FieldNumber_Type]; - return GPBGetMessageInt32Field(message, field); + GPBDescriptor *descriptor = [SVGAProtoShapeEntity descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:SVGAProtoShapeEntity_FieldNumber_Type]; + return GPBGetMessageInt32Field(message, field); } void SetSVGAProtoShapeEntity_Type_RawValue(SVGAProtoShapeEntity *message, int32_t value) { - GPBDescriptor *descriptor = [SVGAProtoShapeEntity descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:SVGAProtoShapeEntity_FieldNumber_Type]; - GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax); + GPBDescriptor *descriptor = [SVGAProtoShapeEntity descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:SVGAProtoShapeEntity_FieldNumber_Type]; + GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax); } void SVGAProtoShapeEntity_ClearArgsOneOfCase(SVGAProtoShapeEntity *message) { - GPBDescriptor *descriptor = [message descriptor]; - GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; - GPBMaybeClearOneof(message, oneof, -1, 0); + GPBDescriptor *descriptor = [message descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBMaybeClearOneof(message, oneof, -1, 0); } #pragma mark - Enum SVGAProtoShapeEntity_ShapeType GPBEnumDescriptor *SVGAProtoShapeEntity_ShapeType_EnumDescriptor(void) { - static GPBEnumDescriptor *descriptor = NULL; - if (!descriptor) { - static const char *valueNames = + static GPBEnumDescriptor *descriptor = NULL; + if (!descriptor) { + static const char *valueNames = "Shape\000Rect\000Ellipse\000Keep\000"; - static const int32_t values[] = { - SVGAProtoShapeEntity_ShapeType_Shape, - SVGAProtoShapeEntity_ShapeType_Rect, - SVGAProtoShapeEntity_ShapeType_Ellipse, - SVGAProtoShapeEntity_ShapeType_Keep, - }; - GPBEnumDescriptor *worker = + static const int32_t values[] = { + SVGAProtoShapeEntity_ShapeType_Shape, + SVGAProtoShapeEntity_ShapeType_Rect, + SVGAProtoShapeEntity_ShapeType_Ellipse, + SVGAProtoShapeEntity_ShapeType_Keep, + }; + GPBEnumDescriptor *worker = [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(SVGAProtoShapeEntity_ShapeType) valueNames:valueNames values:values count:(uint32_t)(sizeof(values) / sizeof(int32_t)) enumVerifier:SVGAProtoShapeEntity_ShapeType_IsValidValue]; - if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) { - [worker release]; + if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) { + [worker release]; + } } - } - return descriptor; + return descriptor; } BOOL SVGAProtoShapeEntity_ShapeType_IsValidValue(int32_t value__) { - switch (value__) { - case SVGAProtoShapeEntity_ShapeType_Shape: - case SVGAProtoShapeEntity_ShapeType_Rect: - case SVGAProtoShapeEntity_ShapeType_Ellipse: - case SVGAProtoShapeEntity_ShapeType_Keep: - return YES; - default: - return NO; - } + switch (value__) { + case SVGAProtoShapeEntity_ShapeType_Shape: + case SVGAProtoShapeEntity_ShapeType_Rect: + case SVGAProtoShapeEntity_ShapeType_Ellipse: + case SVGAProtoShapeEntity_ShapeType_Keep: + return YES; + default: + return NO; + } } #pragma mark - SVGAProtoShapeEntity_ShapeArgs @@ -525,27 +628,27 @@ @implementation SVGAProtoShapeEntity_ShapeArgs @dynamic d; typedef struct SVGAProtoShapeEntity_ShapeArgs__storage_ { - uint32_t _has_storage_[1]; - NSString *d; + uint32_t _has_storage_[1]; + NSString *d; } SVGAProtoShapeEntity_ShapeArgs__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. + (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "d", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_ShapeArgs_FieldNumber_D, - .hasIndex = 0, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeArgs__storage_, d), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeString, - }, - }; - GPBDescriptor *localDescriptor = + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "d", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_ShapeArgs_FieldNumber_D, + .hasIndex = 0, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeArgs__storage_, d), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + }; + GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[SVGAProtoShapeEntity_ShapeArgs class] rootClass:[SVGAProtoSvgaRoot class] file:SVGAProtoSvgaRoot_FileDescriptor() @@ -553,11 +656,11 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(SVGAProtoShapeEntity_ShapeArgs__storage_) flags:GPBDescriptorInitializationFlag_None]; - [localDescriptor setupContainingMessageClassName:GPBStringifySymbol(SVGAProtoShapeEntity)]; - NSAssert(descriptor == nil, @"Startup recursed!"); - descriptor = localDescriptor; - } - return descriptor; + [localDescriptor setupContainingMessageClassName:GPBStringifySymbol(SVGAProtoShapeEntity)]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; } @end @@ -573,67 +676,67 @@ @implementation SVGAProtoShapeEntity_RectArgs @dynamic cornerRadius; typedef struct SVGAProtoShapeEntity_RectArgs__storage_ { - uint32_t _has_storage_[1]; - float x; - float y; - float width; - float height; - float cornerRadius; + uint32_t _has_storage_[1]; + float x; + float y; + float width; + float height; + float cornerRadius; } SVGAProtoShapeEntity_RectArgs__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. + (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "x", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_RectArgs_FieldNumber_X, - .hasIndex = 0, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_RectArgs__storage_, x), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "y", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_RectArgs_FieldNumber_Y, - .hasIndex = 1, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_RectArgs__storage_, y), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "width", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_RectArgs_FieldNumber_Width, - .hasIndex = 2, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_RectArgs__storage_, width), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "height", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_RectArgs_FieldNumber_Height, - .hasIndex = 3, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_RectArgs__storage_, height), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "cornerRadius", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_RectArgs_FieldNumber_CornerRadius, - .hasIndex = 4, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_RectArgs__storage_, cornerRadius), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), - .dataType = GPBDataTypeFloat, - }, - }; - GPBDescriptor *localDescriptor = + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "x", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_RectArgs_FieldNumber_X, + .hasIndex = 0, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_RectArgs__storage_, x), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "y", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_RectArgs_FieldNumber_Y, + .hasIndex = 1, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_RectArgs__storage_, y), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "width", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_RectArgs_FieldNumber_Width, + .hasIndex = 2, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_RectArgs__storage_, width), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "height", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_RectArgs_FieldNumber_Height, + .hasIndex = 3, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_RectArgs__storage_, height), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "cornerRadius", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_RectArgs_FieldNumber_CornerRadius, + .hasIndex = 4, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_RectArgs__storage_, cornerRadius), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeFloat, + }, + }; + GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[SVGAProtoShapeEntity_RectArgs class] rootClass:[SVGAProtoSvgaRoot class] file:SVGAProtoSvgaRoot_FileDescriptor() @@ -642,15 +745,15 @@ + (GPBDescriptor *)descriptor { storageSize:sizeof(SVGAProtoShapeEntity_RectArgs__storage_) flags:GPBDescriptorInitializationFlag_None]; #if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS - static const char *extraTextFormatInfo = + static const char *extraTextFormatInfo = "\001\005\014\000"; - [localDescriptor setupExtraTextInfo:extraTextFormatInfo]; + [localDescriptor setupExtraTextInfo:extraTextFormatInfo]; #endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS - [localDescriptor setupContainingMessageClassName:GPBStringifySymbol(SVGAProtoShapeEntity)]; - NSAssert(descriptor == nil, @"Startup recursed!"); - descriptor = localDescriptor; - } - return descriptor; + [localDescriptor setupContainingMessageClassName:GPBStringifySymbol(SVGAProtoShapeEntity)]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; } @end @@ -665,57 +768,57 @@ @implementation SVGAProtoShapeEntity_EllipseArgs @dynamic radiusY; typedef struct SVGAProtoShapeEntity_EllipseArgs__storage_ { - uint32_t _has_storage_[1]; - float x; - float y; - float radiusX; - float radiusY; + uint32_t _has_storage_[1]; + float x; + float y; + float radiusX; + float radiusY; } SVGAProtoShapeEntity_EllipseArgs__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. + (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "x", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_EllipseArgs_FieldNumber_X, - .hasIndex = 0, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_EllipseArgs__storage_, x), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "y", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_EllipseArgs_FieldNumber_Y, - .hasIndex = 1, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_EllipseArgs__storage_, y), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "radiusX", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_EllipseArgs_FieldNumber_RadiusX, - .hasIndex = 2, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_EllipseArgs__storage_, radiusX), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), - .dataType = GPBDataTypeFloat, - }, - { - .name = "radiusY", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_EllipseArgs_FieldNumber_RadiusY, - .hasIndex = 3, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_EllipseArgs__storage_, radiusY), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), - .dataType = GPBDataTypeFloat, - }, - }; - GPBDescriptor *localDescriptor = + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "x", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_EllipseArgs_FieldNumber_X, + .hasIndex = 0, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_EllipseArgs__storage_, x), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "y", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_EllipseArgs_FieldNumber_Y, + .hasIndex = 1, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_EllipseArgs__storage_, y), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "radiusX", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_EllipseArgs_FieldNumber_RadiusX, + .hasIndex = 2, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_EllipseArgs__storage_, radiusX), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeFloat, + }, + { + .name = "radiusY", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_EllipseArgs_FieldNumber_RadiusY, + .hasIndex = 3, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_EllipseArgs__storage_, radiusY), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeFloat, + }, + }; + GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[SVGAProtoShapeEntity_EllipseArgs class] rootClass:[SVGAProtoSvgaRoot class] file:SVGAProtoSvgaRoot_FileDescriptor() @@ -724,15 +827,15 @@ + (GPBDescriptor *)descriptor { storageSize:sizeof(SVGAProtoShapeEntity_EllipseArgs__storage_) flags:GPBDescriptorInitializationFlag_None]; #if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS - static const char *extraTextFormatInfo = + static const char *extraTextFormatInfo = "\002\003\007\000\004\007\000"; - [localDescriptor setupExtraTextInfo:extraTextFormatInfo]; + [localDescriptor setupExtraTextInfo:extraTextFormatInfo]; #endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS - [localDescriptor setupContainingMessageClassName:GPBStringifySymbol(SVGAProtoShapeEntity)]; - NSAssert(descriptor == nil, @"Startup recursed!"); - descriptor = localDescriptor; - } - return descriptor; + [localDescriptor setupContainingMessageClassName:GPBStringifySymbol(SVGAProtoShapeEntity)]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; } @end @@ -752,107 +855,107 @@ @implementation SVGAProtoShapeEntity_ShapeStyle @dynamic lineDashIii; typedef struct SVGAProtoShapeEntity_ShapeStyle__storage_ { - uint32_t _has_storage_[1]; - float strokeWidth; - SVGAProtoShapeEntity_ShapeStyle_LineCap lineCap; - SVGAProtoShapeEntity_ShapeStyle_LineJoin lineJoin; - float miterLimit; - float lineDashI; - float lineDashIi; - float lineDashIii; - SVGAProtoShapeEntity_ShapeStyle_RGBAColor *fill; - SVGAProtoShapeEntity_ShapeStyle_RGBAColor *stroke; + uint32_t _has_storage_[1]; + float strokeWidth; + SVGAProtoShapeEntity_ShapeStyle_LineCap lineCap; + SVGAProtoShapeEntity_ShapeStyle_LineJoin lineJoin; + float miterLimit; + float lineDashI; + float lineDashIi; + float lineDashIii; + SVGAProtoShapeEntity_ShapeStyle_RGBAColor *fill; + SVGAProtoShapeEntity_ShapeStyle_RGBAColor *stroke; } SVGAProtoShapeEntity_ShapeStyle__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. + (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "fill", - .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoShapeEntity_ShapeStyle_RGBAColor), - .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_Fill, - .hasIndex = 0, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, fill), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "stroke", - .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoShapeEntity_ShapeStyle_RGBAColor), - .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_Stroke, - .hasIndex = 1, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, stroke), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "strokeWidth", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_StrokeWidth, - .hasIndex = 2, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, strokeWidth), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), - .dataType = GPBDataTypeFloat, - }, - { - .name = "lineCap", - .dataTypeSpecific.enumDescFunc = SVGAProtoShapeEntity_ShapeStyle_LineCap_EnumDescriptor, - .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineCap, - .hasIndex = 3, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, lineCap), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom | GPBFieldHasEnumDescriptor), - .dataType = GPBDataTypeEnum, - }, - { - .name = "lineJoin", - .dataTypeSpecific.enumDescFunc = SVGAProtoShapeEntity_ShapeStyle_LineJoin_EnumDescriptor, - .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineJoin, - .hasIndex = 4, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, lineJoin), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom | GPBFieldHasEnumDescriptor), - .dataType = GPBDataTypeEnum, - }, - { - .name = "miterLimit", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_MiterLimit, - .hasIndex = 5, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, miterLimit), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), - .dataType = GPBDataTypeFloat, - }, - { - .name = "lineDashI", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineDashI, - .hasIndex = 6, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, lineDashI), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), - .dataType = GPBDataTypeFloat, - }, - { - .name = "lineDashIi", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineDashIi, - .hasIndex = 7, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, lineDashIi), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), - .dataType = GPBDataTypeFloat, - }, - { - .name = "lineDashIii", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineDashIii, - .hasIndex = 8, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, lineDashIii), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), - .dataType = GPBDataTypeFloat, - }, - }; - GPBDescriptor *localDescriptor = + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "fill", + .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoShapeEntity_ShapeStyle_RGBAColor), + .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_Fill, + .hasIndex = 0, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, fill), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "stroke", + .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoShapeEntity_ShapeStyle_RGBAColor), + .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_Stroke, + .hasIndex = 1, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, stroke), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "strokeWidth", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_StrokeWidth, + .hasIndex = 2, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, strokeWidth), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeFloat, + }, + { + .name = "lineCap", + .dataTypeSpecific.enumDescFunc = SVGAProtoShapeEntity_ShapeStyle_LineCap_EnumDescriptor, + .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineCap, + .hasIndex = 3, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, lineCap), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom | GPBFieldHasEnumDescriptor), + .dataType = GPBDataTypeEnum, + }, + { + .name = "lineJoin", + .dataTypeSpecific.enumDescFunc = SVGAProtoShapeEntity_ShapeStyle_LineJoin_EnumDescriptor, + .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineJoin, + .hasIndex = 4, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, lineJoin), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom | GPBFieldHasEnumDescriptor), + .dataType = GPBDataTypeEnum, + }, + { + .name = "miterLimit", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_MiterLimit, + .hasIndex = 5, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, miterLimit), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeFloat, + }, + { + .name = "lineDashI", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineDashI, + .hasIndex = 6, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, lineDashI), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeFloat, + }, + { + .name = "lineDashIi", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineDashIi, + .hasIndex = 7, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, lineDashIi), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeFloat, + }, + { + .name = "lineDashIii", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineDashIii, + .hasIndex = 8, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle__storage_, lineDashIii), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeFloat, + }, + }; + GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[SVGAProtoShapeEntity_ShapeStyle class] rootClass:[SVGAProtoSvgaRoot class] file:SVGAProtoSvgaRoot_FileDescriptor() @@ -861,118 +964,118 @@ + (GPBDescriptor *)descriptor { storageSize:sizeof(SVGAProtoShapeEntity_ShapeStyle__storage_) flags:GPBDescriptorInitializationFlag_None]; #if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS - static const char *extraTextFormatInfo = + static const char *extraTextFormatInfo = "\007\003\013\000\004\007\000\005\010\000\006\n\000\007\t\000\010\tA\000\t\tb\000"; - [localDescriptor setupExtraTextInfo:extraTextFormatInfo]; + [localDescriptor setupExtraTextInfo:extraTextFormatInfo]; #endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS - [localDescriptor setupContainingMessageClassName:GPBStringifySymbol(SVGAProtoShapeEntity)]; - NSAssert(descriptor == nil, @"Startup recursed!"); - descriptor = localDescriptor; - } - return descriptor; + [localDescriptor setupContainingMessageClassName:GPBStringifySymbol(SVGAProtoShapeEntity)]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; } @end int32_t SVGAProtoShapeEntity_ShapeStyle_LineCap_RawValue(SVGAProtoShapeEntity_ShapeStyle *message) { - GPBDescriptor *descriptor = [SVGAProtoShapeEntity_ShapeStyle descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineCap]; - return GPBGetMessageInt32Field(message, field); + GPBDescriptor *descriptor = [SVGAProtoShapeEntity_ShapeStyle descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineCap]; + return GPBGetMessageInt32Field(message, field); } void SetSVGAProtoShapeEntity_ShapeStyle_LineCap_RawValue(SVGAProtoShapeEntity_ShapeStyle *message, int32_t value) { - GPBDescriptor *descriptor = [SVGAProtoShapeEntity_ShapeStyle descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineCap]; - GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax); + GPBDescriptor *descriptor = [SVGAProtoShapeEntity_ShapeStyle descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineCap]; + GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax); } int32_t SVGAProtoShapeEntity_ShapeStyle_LineJoin_RawValue(SVGAProtoShapeEntity_ShapeStyle *message) { - GPBDescriptor *descriptor = [SVGAProtoShapeEntity_ShapeStyle descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineJoin]; - return GPBGetMessageInt32Field(message, field); + GPBDescriptor *descriptor = [SVGAProtoShapeEntity_ShapeStyle descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineJoin]; + return GPBGetMessageInt32Field(message, field); } void SetSVGAProtoShapeEntity_ShapeStyle_LineJoin_RawValue(SVGAProtoShapeEntity_ShapeStyle *message, int32_t value) { - GPBDescriptor *descriptor = [SVGAProtoShapeEntity_ShapeStyle descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineJoin]; - GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax); + GPBDescriptor *descriptor = [SVGAProtoShapeEntity_ShapeStyle descriptor]; + GPBFieldDescriptor *field = [descriptor fieldWithNumber:SVGAProtoShapeEntity_ShapeStyle_FieldNumber_LineJoin]; + GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax); } #pragma mark - Enum SVGAProtoShapeEntity_ShapeStyle_LineCap GPBEnumDescriptor *SVGAProtoShapeEntity_ShapeStyle_LineCap_EnumDescriptor(void) { - static GPBEnumDescriptor *descriptor = NULL; - if (!descriptor) { - static const char *valueNames = + static GPBEnumDescriptor *descriptor = NULL; + if (!descriptor) { + static const char *valueNames = "LineCapButt\000LineCapRound\000LineCapSquare\000"; - static const int32_t values[] = { - SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapButt, - SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapRound, - SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapSquare, - }; - static const char *extraTextFormatInfo = "\003\000\007\344\000\001\007\345\000\002\007\346\000"; - GPBEnumDescriptor *worker = + static const int32_t values[] = { + SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapButt, + SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapRound, + SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapSquare, + }; + static const char *extraTextFormatInfo = "\003\000\007\344\000\001\007\345\000\002\007\346\000"; + GPBEnumDescriptor *worker = [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(SVGAProtoShapeEntity_ShapeStyle_LineCap) valueNames:valueNames values:values count:(uint32_t)(sizeof(values) / sizeof(int32_t)) enumVerifier:SVGAProtoShapeEntity_ShapeStyle_LineCap_IsValidValue extraTextFormatInfo:extraTextFormatInfo]; - if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) { - [worker release]; + if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) { + [worker release]; + } } - } - return descriptor; + return descriptor; } BOOL SVGAProtoShapeEntity_ShapeStyle_LineCap_IsValidValue(int32_t value__) { - switch (value__) { - case SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapButt: - case SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapRound: - case SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapSquare: - return YES; - default: - return NO; - } + switch (value__) { + case SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapButt: + case SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapRound: + case SVGAProtoShapeEntity_ShapeStyle_LineCap_LineCapSquare: + return YES; + default: + return NO; + } } #pragma mark - Enum SVGAProtoShapeEntity_ShapeStyle_LineJoin GPBEnumDescriptor *SVGAProtoShapeEntity_ShapeStyle_LineJoin_EnumDescriptor(void) { - static GPBEnumDescriptor *descriptor = NULL; - if (!descriptor) { - static const char *valueNames = + static GPBEnumDescriptor *descriptor = NULL; + if (!descriptor) { + static const char *valueNames = "LineJoinMiter\000LineJoinRound\000LineJoinBeve" "l\000"; - static const int32_t values[] = { - SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinMiter, - SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinRound, - SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinBevel, - }; - static const char *extraTextFormatInfo = "\003\000\010\345\000\001\010\345\000\002\010\345\000"; - GPBEnumDescriptor *worker = + static const int32_t values[] = { + SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinMiter, + SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinRound, + SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinBevel, + }; + static const char *extraTextFormatInfo = "\003\000\010\345\000\001\010\345\000\002\010\345\000"; + GPBEnumDescriptor *worker = [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(SVGAProtoShapeEntity_ShapeStyle_LineJoin) valueNames:valueNames values:values count:(uint32_t)(sizeof(values) / sizeof(int32_t)) enumVerifier:SVGAProtoShapeEntity_ShapeStyle_LineJoin_IsValidValue extraTextFormatInfo:extraTextFormatInfo]; - if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) { - [worker release]; + if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) { + [worker release]; + } } - } - return descriptor; + return descriptor; } BOOL SVGAProtoShapeEntity_ShapeStyle_LineJoin_IsValidValue(int32_t value__) { - switch (value__) { - case SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinMiter: - case SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinRound: - case SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinBevel: - return YES; - default: - return NO; - } + switch (value__) { + case SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinMiter: + case SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinRound: + case SVGAProtoShapeEntity_ShapeStyle_LineJoin_LineJoinBevel: + return YES; + default: + return NO; + } } #pragma mark - SVGAProtoShapeEntity_ShapeStyle_RGBAColor @@ -985,57 +1088,57 @@ @implementation SVGAProtoShapeEntity_ShapeStyle_RGBAColor @dynamic a; typedef struct SVGAProtoShapeEntity_ShapeStyle_RGBAColor__storage_ { - uint32_t _has_storage_[1]; - float r; - float g; - float b; - float a; + uint32_t _has_storage_[1]; + float r; + float g; + float b; + float a; } SVGAProtoShapeEntity_ShapeStyle_RGBAColor__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. + (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "r", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_R, - .hasIndex = 0, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle_RGBAColor__storage_, r), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "g", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_G, - .hasIndex = 1, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle_RGBAColor__storage_, g), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "b", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_B, - .hasIndex = 2, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle_RGBAColor__storage_, b), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "a", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_A, - .hasIndex = 3, - .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle_RGBAColor__storage_, a), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - }; - GPBDescriptor *localDescriptor = + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "r", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_R, + .hasIndex = 0, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle_RGBAColor__storage_, r), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "g", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_G, + .hasIndex = 1, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle_RGBAColor__storage_, g), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "b", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_B, + .hasIndex = 2, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle_RGBAColor__storage_, b), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "a", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoShapeEntity_ShapeStyle_RGBAColor_FieldNumber_A, + .hasIndex = 3, + .offset = (uint32_t)offsetof(SVGAProtoShapeEntity_ShapeStyle_RGBAColor__storage_, a), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + }; + GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[SVGAProtoShapeEntity_ShapeStyle_RGBAColor class] rootClass:[SVGAProtoSvgaRoot class] file:SVGAProtoSvgaRoot_FileDescriptor() @@ -1043,11 +1146,11 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(SVGAProtoShapeEntity_ShapeStyle_RGBAColor__storage_) flags:GPBDescriptorInitializationFlag_None]; - [localDescriptor setupContainingMessageClassName:GPBStringifySymbol(SVGAProtoShapeEntity_ShapeStyle)]; - NSAssert(descriptor == nil, @"Startup recursed!"); - descriptor = localDescriptor; - } - return descriptor; + [localDescriptor setupContainingMessageClassName:GPBStringifySymbol(SVGAProtoShapeEntity_ShapeStyle)]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; } @end @@ -1063,67 +1166,67 @@ @implementation SVGAProtoFrameEntity @dynamic shapesArray, shapesArray_Count; typedef struct SVGAProtoFrameEntity__storage_ { - uint32_t _has_storage_[1]; - float alpha; - SVGAProtoLayout *layout; - SVGAProtoTransform *transform; - NSString *clipPath; - NSMutableArray *shapesArray; + uint32_t _has_storage_[1]; + float alpha; + SVGAProtoLayout *layout; + SVGAProtoTransform *transform; + NSString *clipPath; + NSMutableArray *shapesArray; } SVGAProtoFrameEntity__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. + (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "alpha", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoFrameEntity_FieldNumber_Alpha, - .hasIndex = 0, - .offset = (uint32_t)offsetof(SVGAProtoFrameEntity__storage_, alpha), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeFloat, - }, - { - .name = "layout", - .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoLayout), - .number = SVGAProtoFrameEntity_FieldNumber_Layout, - .hasIndex = 1, - .offset = (uint32_t)offsetof(SVGAProtoFrameEntity__storage_, layout), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "transform", - .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoTransform), - .number = SVGAProtoFrameEntity_FieldNumber_Transform, - .hasIndex = 2, - .offset = (uint32_t)offsetof(SVGAProtoFrameEntity__storage_, transform), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "clipPath", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoFrameEntity_FieldNumber_ClipPath, - .hasIndex = 3, - .offset = (uint32_t)offsetof(SVGAProtoFrameEntity__storage_, clipPath), - .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), - .dataType = GPBDataTypeString, - }, - { - .name = "shapesArray", - .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoShapeEntity), - .number = SVGAProtoFrameEntity_FieldNumber_ShapesArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(SVGAProtoFrameEntity__storage_, shapesArray), - .flags = GPBFieldRepeated, - .dataType = GPBDataTypeMessage, - }, - }; - GPBDescriptor *localDescriptor = + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "alpha", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoFrameEntity_FieldNumber_Alpha, + .hasIndex = 0, + .offset = (uint32_t)offsetof(SVGAProtoFrameEntity__storage_, alpha), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeFloat, + }, + { + .name = "layout", + .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoLayout), + .number = SVGAProtoFrameEntity_FieldNumber_Layout, + .hasIndex = 1, + .offset = (uint32_t)offsetof(SVGAProtoFrameEntity__storage_, layout), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "transform", + .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoTransform), + .number = SVGAProtoFrameEntity_FieldNumber_Transform, + .hasIndex = 2, + .offset = (uint32_t)offsetof(SVGAProtoFrameEntity__storage_, transform), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "clipPath", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoFrameEntity_FieldNumber_ClipPath, + .hasIndex = 3, + .offset = (uint32_t)offsetof(SVGAProtoFrameEntity__storage_, clipPath), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom), + .dataType = GPBDataTypeString, + }, + { + .name = "shapesArray", + .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoShapeEntity), + .number = SVGAProtoFrameEntity_FieldNumber_ShapesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(SVGAProtoFrameEntity__storage_, shapesArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[SVGAProtoFrameEntity class] rootClass:[SVGAProtoSvgaRoot class] file:SVGAProtoSvgaRoot_FileDescriptor() @@ -1132,14 +1235,14 @@ + (GPBDescriptor *)descriptor { storageSize:sizeof(SVGAProtoFrameEntity__storage_) flags:GPBDescriptorInitializationFlag_None]; #if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS - static const char *extraTextFormatInfo = + static const char *extraTextFormatInfo = "\001\004\010\000"; - [localDescriptor setupExtraTextInfo:extraTextFormatInfo]; + [localDescriptor setupExtraTextInfo:extraTextFormatInfo]; #endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS - NSAssert(descriptor == nil, @"Startup recursed!"); - descriptor = localDescriptor; - } - return descriptor; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; } @end @@ -1152,59 +1255,70 @@ @implementation SVGAProtoMovieEntity @dynamic hasParams, params; @dynamic images, images_Count; @dynamic spritesArray, spritesArray_Count; +@dynamic audiosArray, audiosArray_Count; typedef struct SVGAProtoMovieEntity__storage_ { - uint32_t _has_storage_[1]; - NSString *version; - SVGAProtoMovieParams *params; - NSMutableDictionary *images; - NSMutableArray *spritesArray; + uint32_t _has_storage_[1]; + NSString *version; + SVGAProtoMovieParams *params; + NSMutableDictionary *images; + NSMutableArray *spritesArray; + NSMutableArray *audiosArray; } SVGAProtoMovieEntity__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. + (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "version", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoMovieEntity_FieldNumber_Version, - .hasIndex = 0, - .offset = (uint32_t)offsetof(SVGAProtoMovieEntity__storage_, version), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeString, - }, - { - .name = "params", - .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoMovieParams), - .number = SVGAProtoMovieEntity_FieldNumber_Params, - .hasIndex = 1, - .offset = (uint32_t)offsetof(SVGAProtoMovieEntity__storage_, params), - .flags = GPBFieldOptional, - .dataType = GPBDataTypeMessage, - }, - { - .name = "images", - .dataTypeSpecific.className = NULL, - .number = SVGAProtoMovieEntity_FieldNumber_Images, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(SVGAProtoMovieEntity__storage_, images), - .flags = GPBFieldMapKeyString, - .dataType = GPBDataTypeBytes, - }, - { - .name = "spritesArray", - .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoSpriteEntity), - .number = SVGAProtoMovieEntity_FieldNumber_SpritesArray, - .hasIndex = GPBNoHasBit, - .offset = (uint32_t)offsetof(SVGAProtoMovieEntity__storage_, spritesArray), - .flags = GPBFieldRepeated, - .dataType = GPBDataTypeMessage, - }, - }; - GPBDescriptor *localDescriptor = + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "version", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoMovieEntity_FieldNumber_Version, + .hasIndex = 0, + .offset = (uint32_t)offsetof(SVGAProtoMovieEntity__storage_, version), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "params", + .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoMovieParams), + .number = SVGAProtoMovieEntity_FieldNumber_Params, + .hasIndex = 1, + .offset = (uint32_t)offsetof(SVGAProtoMovieEntity__storage_, params), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "images", + .dataTypeSpecific.className = NULL, + .number = SVGAProtoMovieEntity_FieldNumber_Images, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(SVGAProtoMovieEntity__storage_, images), + .flags = GPBFieldMapKeyString, + .dataType = GPBDataTypeBytes, + }, + { + .name = "spritesArray", + .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoSpriteEntity), + .number = SVGAProtoMovieEntity_FieldNumber_SpritesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(SVGAProtoMovieEntity__storage_, spritesArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + { + .name = "audiosArray", + .dataTypeSpecific.className = GPBStringifySymbol(SVGAProtoAudioEntity), + .number = SVGAProtoMovieEntity_FieldNumber_AudiosArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(SVGAProtoMovieEntity__storage_, audiosArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[SVGAProtoMovieEntity class] rootClass:[SVGAProtoSvgaRoot class] file:SVGAProtoSvgaRoot_FileDescriptor() @@ -1212,10 +1326,10 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(SVGAProtoMovieEntity__storage_) flags:GPBDescriptorInitializationFlag_None]; - NSAssert(descriptor == nil, @"Startup recursed!"); - descriptor = localDescriptor; - } - return descriptor; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; } @end diff --git a/readme.md b/readme.md index 34ab9cf0..5c4d0b56 100644 --- a/readme.md +++ b/readme.md @@ -1,135 +1,119 @@ +# Archived +本仓库已经停止维护,你仍然继续阅读源码及创建分叉,但本仓库不会继续更新,也不会回答任何 issue。 + +This repo has stopped maintenance, you can still continue to read the source code and create forks, but this repo will not continue to be updated, nor will it answer any issues. + # SVGAPlayer -## Version +[简体中文](./readme.zh.md) -### 2.1.0 +## 支持本项目 -* Add range play mode. +1. 轻点 GitHub Star,让更多人看到该项目。 -### 2.0.0 +## 2.5.0 Released -#### New Features +This version add Support for matte layer and dynamic matte bitmap.
+Head on over to [Dynamic · Matte Layer](https://github.com/yyued/SVGAPlayer-iOS/wiki/Dynamic-%C2%B7-Matte-Layer) -* Add SVGA-Format 2.0.0 support. -* Add SVGAImageView. -* Add more UIViewContentMode support. +This version add Support for audio step to frame & percentage. -#### Improvements +## 2.3.5 Released -* SVGAParser now can works up-to 8 concurrent tasks. -* Improves BezierPath performance. +This version fixed SVGAPlayer `clearsAfterStop defaults too YES`, Please check your player when it doesn't need to be cleared. -## SVGA Format +This version fixed SVGAPlayer render issue on iOS 13.1, upgrade to this version ASAP. -@see https://github.com/yyued/SVGA-Format +## Introduce -## Install +SVGAPlayer is a light-weight animation renderer. You use [tools](http://svga.io/designer.html) to export `svga` file from `Adobe Animate CC` or `Adobe After Effects`, and then use SVGAPlayer to render animation on mobile application. -### CocoaPods +`SVGAPlayer-iOS` render animation natively via iOS CoreAnimation Framework, brings you a high-performance, low-cost animation experience. -Add following dependency to Podfile -``` -pod 'SVGAPlayer' -``` +If wonder more information, go to this [website](http://svga.io/). ## Usage -### code +Here introduce `SVGAPlayer-iOS` usage. Wonder exporting usage? Click [here](http://svga.io/designer.html). + +### Install Via CocoaPods + +You want to add pod 'SVGAPlayer', '~> 2.3' similar to the following to your Podfile: + +target 'MyApp' do + pod 'SVGAPlayer', '~> 2.3' +end + +Then run a `pod install` inside your terminal, or from CocoaPods.app. + +### Locate files + +SVGAPlayer could load svga file from application bundle or remote server. +### Using code + +#### Create a `SVGAPlayer` instance. + +```objectivec +SVGAPlayer *player = [[SVGAPlayer alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; +[self.view addSubview:player]; // Add subview by yourself. ``` + +#### Create a `SVGAParser` instance, parse from bundle like this. +```objectivec SVGAParser *parser = [[SVGAParser alloc] init]; -SVGAPlayer *player = [[SVGAPlayer alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; -[self.view addSubview:player]; -[parser parseWithURL:[NSURL URLWithString:@"http://uedfe.yypm.com/assets/svga-samples/angel.svga"] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) { +[parser parseWithNamed:@"posche" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { + +} failureBlock:nil]; +``` + +#### Create a `SVGAParser` instance, parse from remote server like this. + +```objectivec +SVGAParser *parser = [[SVGAParser alloc] init]; +[parser parseWithURL:[NSURL URLWithString:@"https://github.com/yyued/SVGA-Samples/blob/master/posche.svga?raw=true"] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) { + +} failureBlock:nil]; +``` + +#### Set videoItem to `SVGAPlayer`, play it as you want. + +```objectivec +[parser parseWithURL:[NSURL URLWithString:@"https://github.com/yyued/SVGA-Samples/blob/master/posche.svga?raw=true"] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) { if (videoItem != nil) { player.videoItem = videoItem; [player startAnimation]; } } failureBlock:nil]; - ``` -### xib - -1. Add UIView to IB layout area. -2. Let UIView subclass SVGAImageView. -3. Input imageName on IB Properties Area. -4. Animation will start after loaded. - -## Cache +### Cache -SVGAParser use NSURLSession request remote data via network. You may use following ways to control cache. +`SVGAParser` use `NSURLSession` request remote data via network. You may use following ways to control cache. -### Response Header +#### Response Header Server response SVGA files in Body, and response header either. response header has cache-control / etag / expired keys, all these keys telling NSURLSession how to handle cache. -### Request NSData By Yourself +#### Request NSData By Yourself If you couldn't fix Server Response Header, You should build NSURLRequest with CachePolicy by yourself, and fetch NSData. Deliver NSData to SVGAParser, as usual. -## API - -### Properties -* id delegate; - Callbacks -* SVGAVideoEntity *videoItem; - Animation Instance -* Int loops; - Loop Count,0 = Infinity Loop -* BOOL clearsAfterStop; - Clears Canvas After Animation Stop -* String fillMode; - defaults to Forward,optional Forward / Backward,fillMode = Forward,Animation will pause on last frame while finished,fillMode = Backward , Animation will pause on first frame. - -### Methods +## Features -* (void)startAnimation; - Play Animation from 0 frame. -* (void)startAnimationWithRange:(NSRange)range reverse:(BOOL)reverse; -* (void)pauseAnimation; - Pause Animation and keep on current frame. -* (void)stopAnimation; - Stop Animation,Clears Canvas while clearsAfterStop == YES. -* (void)clear; - Clear Canvas force. -* (void)stepToFrame:(NSInteger)frame andPlay:(BOOL)andPlay; - Step to N frame, and then Play Animation if andPlay === true. -* (void)stepToPercentage:(CGFloat)percentage andPlay:(BOOL)andPlay; - Step to x%, and then Play Animation if andPlay === true. -* (void)setImage:(UIImage *)image forKey:(NSString *)aKey; - Set Dynamic Image. -* (void)setImageWithURL:(NSURL *)URL forKey:(NSString *)aKey; - Set Dynamic Image via remote URL. -* (void)setAttributedText:(NSAttributedString *)attributedText forKey:(NSString *)aKey; - Set Dynamic Text. -* (void)clearDynamicObjects; - Clear all dynamic Images and Texts. +Here are many feature samples. -### SVGAPlayerDelegate +* [Replace an element with Bitmap.](https://github.com/yyued/SVGAPlayer-iOS/wiki/Dynamic-Image) +* [Add text above an element.](https://github.com/yyued/SVGAPlayer-iOS/wiki/Dynamic-Text) +* [Hides an element dynamicaly.](https://github.com/yyued/SVGAPlayer-iOS/wiki/Dynamic-Hidden) +* [Use a custom drawer for element.](https://github.com/yyued/SVGAPlayer-iOS/wiki/Dynamic-Drawer) -* @optional -* - (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player; - Call after animation finished. -* - (void)svgaPlayerDidAnimatedToFrame:(NSInteger)frame; - Call after animation play to specific frame. -* - (void)svgaPlayerDidAnimatedToPercentage:(CGFloat)percentage; - Call after animation play to specific percentage. +## APIs -### Dynamic Object +Head on over to [https://github.com/yyued/SVGAPlayer-iOS/wiki/APIs](https://github.com/yyued/SVGAPlayer-iOS/wiki/APIs) -Use this way to replace specific image, or add text to it. (可以通过以下方式,替换动画文件中的指定图像,以及动态添加富文本。) - -#### Dynamic Image - -``` -CALayer *iconLayer = [CALayer layer]; -iconLayer.cornerRadius = 84.0; -iconLayer.masksToBounds = YES; -iconLayer.borderWidth = 4.0; -iconLayer.borderColor = [UIColor colorWithRed:0xea/255.0 green:0xb3/255.0 blue:0x7d/255.0 alpha:1.0].CGColor; -[self.aPlayer setImage:iconImage forKey:@"99" referenceLayer:iconLayer]; -``` - -* Ask designer tell you the imageKey(or unzip the svga file, find it). - -#### Dynamic Text - -``` -NSShadow *shadow = [NSShadow new]; -shadow.shadowColor = [UIColor blackColor]; -shadow.shadowOffset = CGSizeMake(0, 1); -NSAttributedString *text = [[NSAttributedString alloc] initWithString:@"崔小姐不吃鱼 送了魔法奇缘" - attributes:@{ - NSForegroundColorAttributeName: [UIColor colorWithRed:0xff/255.0 green:0xe0/255.0 blue:0xa4/255.0 alpha:1.0], - NSFontAttributeName: [UIFont boldSystemFontOfSize:30.0], - NSShadowAttributeName: shadow, - }]; -[self.aPlayer setAttributedText:text forKey:@"banner"]; -``` +## CHANGELOG -* Ask designer tell you the imageKey(or unzip the svga file, find it). +Head on over to [CHANGELOG](./CHANGELOG.md) diff --git a/readme.zh.md b/readme.zh.md new file mode 100644 index 00000000..68248412 --- /dev/null +++ b/readme.zh.md @@ -0,0 +1,104 @@ +# SVGAPlayer + +## 2.5.0 版本 + +该版本增加了对遮罩图层和遮罩图片动态替换的支持。
+请参阅此处 [Dynamic · Matte Layer](https://github.com/yyued/SVGAPlayer-iOS/wiki/Dynamic-%C2%B7-Matte-Layer) + +该版本增加了对音频进度切换的支持。 + +## 2.3.5 版本 + +该版本修正了 SVGAPlayer `clearsAfterStop 默认值为 YES`,请检查代码,修正不需要 clear 的 SVGAPlayer。 + +该版本修正了 SVGAPlayer 无法在 iOS 13.1 上播放异常的问题,请尽快升级。 + +## 介绍 + +`SVGAPlayer` 是一个轻量的动画渲染库。你可以使用[工具](http://svga.io/designer.html)从 `Adobe Animate CC` 或者 `Adobe After Effects` 中导出动画文件,然后使用 `SVGAPlayer` 在移动设备上渲染并播放。 + +`SVGAPlayer-iOS` 使用原生 CoreAnimation 库渲染动画,为你提供高性能、低开销的动画体验。 + +如果你想要了解更多细节,请访问[官方网站](http://svga.io/)。 + +## 用法 + +我们在这里介绍 `SVGAPlayer-iOS` 的用法。想要知道如何导出动画,点击[这里](http://svga.io/designer.html)。 + +### 使用 CocoaPods 安装依赖 + +添加依赖 'SVGAPlayer', '~> 2.3' 到 Podfile 文件中: + +target 'MyApp' do + pod 'SVGAPlayer', '~> 2.3' +end + +然后在终端执行 `pod install`。 + +### 放置 svga 文件 + +SVGAPlayer 可以从应用包,或者远端服务器上加载动画文件。 + +### 代码 + +#### 创建一个 `SVGAPlayer` 实例 + +```objectivec +SVGAPlayer *player = [[SVGAPlayer alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; +[self.view addSubview:player]; // Add subview by yourself. +``` + +#### 创建一个 `SVGAParser` 实例,使用以下方法从应用包中加载动画。 +```objectivec +SVGAParser *parser = [[SVGAParser alloc] init]; +[parser parseWithNamed:@"posche" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { + +} failureBlock:nil]; +``` + +#### 创建一个 `SVGAParser` 实例,使用以下方法从远端服务器中加载动画。 + +```objectivec +SVGAParser *parser = [[SVGAParser alloc] init]; +[parser parseWithURL:[NSURL URLWithString:@"https://github.com/yyued/SVGA-Samples/blob/master/posche.svga?raw=true"] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) { + +} failureBlock:nil]; +``` + +#### 将 videoItem 赋值给 `SVGAPlayer`,然后播放动画。 + +```objectivec +[parser parseWithURL:[NSURL URLWithString:@"https://github.com/yyued/SVGA-Samples/blob/master/posche.svga?raw=true"] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) { + if (videoItem != nil) { + player.videoItem = videoItem; + [player startAnimation]; + } +} failureBlock:nil]; +``` + +### 缓存 + +`SVGAParser` 使用 `NSURLSession` 请求远端数据,你需要通过以下方式缓存动画文件。 + +#### HTTP 结果头部信息 + +如果服务器返回的头部信息包含 cache-control / etag / expired 这些键值,这个请求会被合理地缓存到本地。 + +#### 自行缓存 NSData + +如果你没有办法控制服务器返回的头部信息,你可以自行获取对应的 svga 文件 `NSData` 数据,然后使用 `SVGAParser` 解析这些数据。 + +## 功能示例 + +* [使用位图替换指定元素。](https://github.com/yyued/SVGAPlayer-iOS/wiki/Dynamic-Image) +* [在指定元素上绘制文本。](https://github.com/yyued/SVGAPlayer-iOS/wiki/Dynamic-Text) +* [隐藏指定元素。](https://github.com/yyued/SVGAPlayer-iOS/wiki/Dynamic-Hidden) +* [在指定元素上自由绘制。](https://github.com/yyued/SVGAPlayer-iOS/wiki/Dynamic-Drawer) + +## APIs + +请参阅此处 [https://github.com/yyued/SVGAPlayer-iOS/wiki/APIs](https://github.com/yyued/SVGAPlayer-iOS/wiki/APIs) + +## CHANGELOG + +请参阅此处 [CHANGELOG](./CHANGELOG.md)