Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
feat: update 2.x proto support for matte.
Browse files Browse the repository at this point in the history
  • Loading branch information
errnull committed Jun 17, 2019
1 parent fc9d7ef commit 2b28845
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions SVGAPlayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
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 */; };
71A8679122B7785100176CD6 /* matteRect.svga in Resources */ = {isa = PBXBuildFile; fileRef = 71A8679022B7785100176CD6 /* matteRect.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 */; };
Expand Down Expand Up @@ -65,6 +66,7 @@
63E816FF2178809D001D2D62 /* SVGAAudioLayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAAudioLayer.h; sourceTree = "<group>"; };
63E817002178809D001D2D62 /* SVGAAudioLayer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SVGAAudioLayer.m; sourceTree = "<group>"; };
71418C92225E6F710029C69E /* mutiMatte.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = mutiMatte.svga; sourceTree = "<group>"; };
71A8679022B7785100176CD6 /* matteRect.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = matteRect.svga; sourceTree = "<group>"; };
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 = "<group>"; };
904D41F61D223DD20085A21A /* SVGABezierPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGABezierPath.h; sourceTree = "<group>"; };
904D41F71D223DD20085A21A /* SVGABezierPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGABezierPath.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -241,6 +243,7 @@
90D7C9FA1F7E2AA3006E74F0 /* Samples */ = {
isa = PBXGroup;
children = (
71A8679022B7785100176CD6 /* matteRect.svga */,
71418C92225E6F710029C69E /* mutiMatte.svga */,
63712E6421787950001AE014 /* heartbeat.svga */,
90D7CA1A1F7FB114006E74F0 /* rose_1.5.0.svga */,
Expand Down Expand Up @@ -356,6 +359,7 @@
63712E6521787950001AE014 /* heartbeat.svga in Resources */,
90A676EB1D13A6DF008A69F3 /* Main.storyboard in Resources */,
90CB64F91EF297E800DAA382 /* SVGAPlayer React-Info.plist in Resources */,
71A8679122B7785100176CD6 /* matteRect.svga in Resources */,
90D7CA1C1F7FB114006E74F0 /* rose_1.5.0.svga in Resources */,
90D7CA1B1F7FB114006E74F0 /* rose_2.0.0.svga in Resources */,
);
Expand Down
Binary file added SVGAPlayer/Samples/matteRect.svga
Binary file not shown.
2 changes: 1 addition & 1 deletion SVGAPlayer/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ - (void)viewDidLoad {
}

- (IBAction)onChange:(id)sender {
[parser parseWithNamed:@"rose_2.0.0"
[parser parseWithNamed:@"matteRect"
inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
if (videoItem != nil) {
self.aPlayer.videoItem = videoItem;
Expand Down
1 change: 1 addition & 0 deletions Source/SVGAVideoEntity.m
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ @interface SVGAVideoSpriteEntity()

@property (nonatomic, copy) NSString *imageKey;
@property (nonatomic, copy) NSArray<SVGAVideoSpriteFrameEntity *> *frames;
@property (nonatomic, copy) NSString *matteKey;

@end

2 changes: 1 addition & 1 deletion Source/SVGAVideoSpriteEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
@interface SVGAVideoSpriteEntity : NSObject

@property (nonatomic, readonly) NSString *imageKey;
@property (nonatomic, readonly) NSString *matteKey;
@property (nonatomic, readonly) NSArray<SVGAVideoSpriteFrameEntity *> *frames;
@property (nonatomic, readonly) NSString *matteKey;

- (instancetype)initWithJSONObject:(NSDictionary *)JSONObject;
- (instancetype)initWithProtoObject:(SVGAProtoSpriteEntity *)protoObject;
Expand Down
4 changes: 3 additions & 1 deletion Source/SVGAVideoSpriteEntity.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ - (instancetype)initWithJSONObject:(NSDictionary *)JSONObject {
[frames addObject:[[SVGAVideoSpriteFrameEntity alloc] initWithJSONObject:obj]];
}
}];
_matteKey = matteKey;
_imageKey = imageKey;
_frames = frames;
_matteKey = matteKey;
}
}
}
Expand All @@ -43,6 +43,7 @@ - (instancetype)initWithProtoObject:(SVGAProtoSpriteEntity *)protoObject {
if (self) {
if ([protoObject isKindOfClass:[SVGAProtoSpriteEntity class]]) {
NSString *imageKey = protoObject.imageKey;
NSString *matteKey = protoObject.matteKey;
NSArray<NSDictionary *> *protoFrames = [protoObject.framesArray copy];
if ([imageKey isKindOfClass:[NSString class]] && [protoFrames isKindOfClass:[NSArray class]]) {
NSMutableArray<SVGAVideoSpriteFrameEntity *> *frames = [[NSMutableArray alloc] init];
Expand All @@ -53,6 +54,7 @@ - (instancetype)initWithProtoObject:(SVGAProtoSpriteEntity *)protoObject {
}];
_imageKey = imageKey;
_frames = frames;
_matteKey = matteKey;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/pbobjc/Svga.pbobjc.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2b28845

Please sign in to comment.