Skip to content

Commit

Permalink
Push From Landun: update SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
libpag-pag committed Nov 13, 2024
1 parent 21e17f4 commit 3f8c71c
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#import <UIKit/UIKit.h>
#import "PAGComposition.h"

NS_ASSUME_NONNULL_BEGIN

/**
* PAGDecoder provides a utility to read image frames directly from a PAGComposition, and caches the
* image frames as a sequence file on the disk, which may significantly speed up the reading process
Expand Down Expand Up @@ -86,14 +84,14 @@ PAG_API @interface PAGDecoder : NSObject
* if failed. Note that caller must ensure that the rowBytes stays the same throughout every copying
* call. Otherwise, it may return false.
*/
- (BOOL)copyFrameTo:(void*)pixels rowBytes:(size_t)rowBytes at:(NSInteger)index;
- (BOOL)copyFrameTo:(void* _Nonnull)pixels rowBytes:(size_t)rowBytes at:(NSInteger)index;

/**
* Reads pixels of the image frame at the given index into the specified CVPixelBuffer. Returns
* false if failed. Reading image frames into HardwareBuffer usually has better performance than
* reading into memory.
*/
- (BOOL)readFrame:(NSInteger)index to:(CVPixelBufferRef)pixelBuffer;
- (BOOL)readFrame:(NSInteger)index to:(CVPixelBufferRef _Nonnull)pixelBuffer;

/**
* Returns the image frame at the specified index. Note that this method must be called while the
Expand All @@ -103,5 +101,3 @@ PAG_API @interface PAGDecoder : NSObject
- (nullable UIImage*)frameAtIndex:(NSInteger)index;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#import <UIKit/UIKit.h>
#import "PAGComposition.h"

NS_ASSUME_NONNULL_BEGIN

@class PAGImageView;

@protocol PAGImageViewListener <NSObject>
Expand All @@ -30,29 +28,29 @@ NS_ASSUME_NONNULL_BEGIN
* Notifies the beginning of the animation. It can be called from either the UI thread or the thread
* that calls the play method.
*/
- (void)onAnimationStart:(PAGImageView*)pagView;
- (void)onAnimationStart:(PAGImageView* _Nonnull)pagView;

/**
* Notifies the end of the animation. It can only be called from the UI thread.
*/
- (void)onAnimationEnd:(PAGImageView*)pagView;
- (void)onAnimationEnd:(PAGImageView* _Nonnull)pagView;

/**
* Notifies the cancellation of the animation. It can be called from either the UI thread or the
* thread that calls the stop method.
*/
- (void)onAnimationCancel:(PAGImageView*)pagView;
- (void)onAnimationCancel:(PAGImageView* _Nonnull)pagView;

/**
* Notifies the repetition of the animation. It can only be called from the UI thread.
*/
- (void)onAnimationRepeat:(PAGImageView*)pagView;
- (void)onAnimationRepeat:(PAGImageView* _Nonnull)pagView;

/**
* Notifies another frame of the animation has occurred. It may be called from an arbitrary
* thread if the animation is running asynchronously.
*/
- (void)onAnimationUpdate:(PAGImageView*)pagView;
- (void)onAnimationUpdate:(PAGImageView* _Nonnull)pagView;

@end

Expand Down Expand Up @@ -82,14 +80,14 @@ PAG_API @interface PAGImageView : UIImageView
* composition is already added to another PAGImageView, it will be removed from the previous
* PAGImageView.
*/
- (void)setComposition:(PAGComposition*)newComposition;
- (void)setComposition:(nullable PAGComposition*)newComposition;

/**
* Sets a new PAGComposition and the maxFrameRate limit to the PAGImageView. Note: If the
* composition is already added to another PAGImageView, it will be removed from the previous
* PAGImageView.
*/
- (void)setComposition:(PAGComposition*)newComposition maxFrameRate:(float)maxFrameRate;
- (void)setComposition:(nullable PAGComposition*)newComposition maxFrameRate:(float)maxFrameRate;

/**
* Returns the file path set by the setPath() method.
Expand All @@ -100,27 +98,28 @@ PAG_API @interface PAGImageView : UIImageView
* Loads a pag file from the specified path, returns false if the file does not exist, or it is not
* a valid pag file.
*/
- (BOOL)setPath:(NSString*)path;
- (BOOL)setPath:(nullable NSString*)path;
/**
* Loads a pag file from the specified path with the maxFrameRate limit, returns false if the file
* does not exist, or it is not a valid pag file.
*/
- (BOOL)setPath:(NSString*)filePath maxFrameRate:(float)maxFrameRate;
- (BOOL)setPath:(nullable NSString*)filePath maxFrameRate:(float)maxFrameRate;

/**
* Asynchronously load a PAG file from the specific path, a block with PAGFile will be called
* when loading is complete. If loading fails, PAGFile will be set to nil.
*/
- (void)setPathAsync:(NSString*)filePath completionBlock:(void (^)(PAGFile*))callback;
- (void)setPathAsync:(nullable NSString*)filePath
completionBlock:(void (^_Nullable)(PAGFile* __nullable))callback;

/**
* Asynchronously load a PAG file from the specific path with the maxFrameRate limit, a block
* with PAGFile will be called when loading is complete. If loading fails, PAGFile will be set to
* nil.
*/
- (void)setPathAsync:(NSString*)filePath
- (void)setPathAsync:(nullable NSString*)filePath
maxFrameRate:(float)maxFrameRate
completionBlock:(void (^)(PAGFile*))callback;
completionBlock:(void (^_Nullable)(PAGFile* __nullable))callback;

/**
* If set to true, the PAGImageView loads all image frames into the memory, which will significantly
Expand Down Expand Up @@ -163,12 +162,12 @@ PAG_API @interface PAGImageView : UIImageView
* Adds a listener to the set of listeners that are sent events through the life of an animation,
* such as start, repeat, and end. PAGImageView only holds a weak reference to the listener.
*/
- (void)addListener:(id<PAGImageViewListener>)listener;
- (void)addListener:(nullable id<PAGImageViewListener>)listener;

/**
* Removes the specified listener from the set of listeners
*/
- (void)removeListener:(id<PAGImageViewListener>)listener;
- (void)removeListener:(nullable id<PAGImageViewListener>)listener;

/**
* Returns the current frame index the PAGImageView is rendering.
Expand All @@ -189,7 +188,7 @@ PAG_API @interface PAGImageView : UIImageView
/**
* Returns a UIImage capturing the contents of the current PAGImageView.
*/
- (UIImage*)currentImage;
- (nullable UIImage*)currentImage;

/**
* Starts to play the animation from the current position. Calling the play() method when the
Expand Down Expand Up @@ -219,5 +218,3 @@ PAG_API @interface PAGImageView : UIImageView
- (BOOL)flush;

@end

NS_ASSUME_NONNULL_END
Binary file not shown.
Binary file modified framework/libpag.xcframework/ios-arm64/libpag.framework/libpag
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#import <UIKit/UIKit.h>
#import "PAGComposition.h"

NS_ASSUME_NONNULL_BEGIN

/**
* PAGDecoder provides a utility to read image frames directly from a PAGComposition, and caches the
* image frames as a sequence file on the disk, which may significantly speed up the reading process
Expand Down Expand Up @@ -86,14 +84,14 @@ PAG_API @interface PAGDecoder : NSObject
* if failed. Note that caller must ensure that the rowBytes stays the same throughout every copying
* call. Otherwise, it may return false.
*/
- (BOOL)copyFrameTo:(void*)pixels rowBytes:(size_t)rowBytes at:(NSInteger)index;
- (BOOL)copyFrameTo:(void* _Nonnull)pixels rowBytes:(size_t)rowBytes at:(NSInteger)index;

/**
* Reads pixels of the image frame at the given index into the specified CVPixelBuffer. Returns
* false if failed. Reading image frames into HardwareBuffer usually has better performance than
* reading into memory.
*/
- (BOOL)readFrame:(NSInteger)index to:(CVPixelBufferRef)pixelBuffer;
- (BOOL)readFrame:(NSInteger)index to:(CVPixelBufferRef _Nonnull)pixelBuffer;

/**
* Returns the image frame at the specified index. Note that this method must be called while the
Expand All @@ -103,5 +101,3 @@ PAG_API @interface PAGDecoder : NSObject
- (nullable UIImage*)frameAtIndex:(NSInteger)index;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#import <UIKit/UIKit.h>
#import "PAGComposition.h"

NS_ASSUME_NONNULL_BEGIN

@class PAGImageView;

@protocol PAGImageViewListener <NSObject>
Expand All @@ -30,29 +28,29 @@ NS_ASSUME_NONNULL_BEGIN
* Notifies the beginning of the animation. It can be called from either the UI thread or the thread
* that calls the play method.
*/
- (void)onAnimationStart:(PAGImageView*)pagView;
- (void)onAnimationStart:(PAGImageView* _Nonnull)pagView;

/**
* Notifies the end of the animation. It can only be called from the UI thread.
*/
- (void)onAnimationEnd:(PAGImageView*)pagView;
- (void)onAnimationEnd:(PAGImageView* _Nonnull)pagView;

/**
* Notifies the cancellation of the animation. It can be called from either the UI thread or the
* thread that calls the stop method.
*/
- (void)onAnimationCancel:(PAGImageView*)pagView;
- (void)onAnimationCancel:(PAGImageView* _Nonnull)pagView;

/**
* Notifies the repetition of the animation. It can only be called from the UI thread.
*/
- (void)onAnimationRepeat:(PAGImageView*)pagView;
- (void)onAnimationRepeat:(PAGImageView* _Nonnull)pagView;

/**
* Notifies another frame of the animation has occurred. It may be called from an arbitrary
* thread if the animation is running asynchronously.
*/
- (void)onAnimationUpdate:(PAGImageView*)pagView;
- (void)onAnimationUpdate:(PAGImageView* _Nonnull)pagView;

@end

Expand Down Expand Up @@ -82,14 +80,14 @@ PAG_API @interface PAGImageView : UIImageView
* composition is already added to another PAGImageView, it will be removed from the previous
* PAGImageView.
*/
- (void)setComposition:(PAGComposition*)newComposition;
- (void)setComposition:(nullable PAGComposition*)newComposition;

/**
* Sets a new PAGComposition and the maxFrameRate limit to the PAGImageView. Note: If the
* composition is already added to another PAGImageView, it will be removed from the previous
* PAGImageView.
*/
- (void)setComposition:(PAGComposition*)newComposition maxFrameRate:(float)maxFrameRate;
- (void)setComposition:(nullable PAGComposition*)newComposition maxFrameRate:(float)maxFrameRate;

/**
* Returns the file path set by the setPath() method.
Expand All @@ -100,27 +98,28 @@ PAG_API @interface PAGImageView : UIImageView
* Loads a pag file from the specified path, returns false if the file does not exist, or it is not
* a valid pag file.
*/
- (BOOL)setPath:(NSString*)path;
- (BOOL)setPath:(nullable NSString*)path;
/**
* Loads a pag file from the specified path with the maxFrameRate limit, returns false if the file
* does not exist, or it is not a valid pag file.
*/
- (BOOL)setPath:(NSString*)filePath maxFrameRate:(float)maxFrameRate;
- (BOOL)setPath:(nullable NSString*)filePath maxFrameRate:(float)maxFrameRate;

/**
* Asynchronously load a PAG file from the specific path, a block with PAGFile will be called
* when loading is complete. If loading fails, PAGFile will be set to nil.
*/
- (void)setPathAsync:(NSString*)filePath completionBlock:(void (^)(PAGFile*))callback;
- (void)setPathAsync:(nullable NSString*)filePath
completionBlock:(void (^_Nullable)(PAGFile* __nullable))callback;

/**
* Asynchronously load a PAG file from the specific path with the maxFrameRate limit, a block
* with PAGFile will be called when loading is complete. If loading fails, PAGFile will be set to
* nil.
*/
- (void)setPathAsync:(NSString*)filePath
- (void)setPathAsync:(nullable NSString*)filePath
maxFrameRate:(float)maxFrameRate
completionBlock:(void (^)(PAGFile*))callback;
completionBlock:(void (^_Nullable)(PAGFile* __nullable))callback;

/**
* If set to true, the PAGImageView loads all image frames into the memory, which will significantly
Expand Down Expand Up @@ -163,12 +162,12 @@ PAG_API @interface PAGImageView : UIImageView
* Adds a listener to the set of listeners that are sent events through the life of an animation,
* such as start, repeat, and end. PAGImageView only holds a weak reference to the listener.
*/
- (void)addListener:(id<PAGImageViewListener>)listener;
- (void)addListener:(nullable id<PAGImageViewListener>)listener;

/**
* Removes the specified listener from the set of listeners
*/
- (void)removeListener:(id<PAGImageViewListener>)listener;
- (void)removeListener:(nullable id<PAGImageViewListener>)listener;

/**
* Returns the current frame index the PAGImageView is rendering.
Expand All @@ -189,7 +188,7 @@ PAG_API @interface PAGImageView : UIImageView
/**
* Returns a UIImage capturing the contents of the current PAGImageView.
*/
- (UIImage*)currentImage;
- (nullable UIImage*)currentImage;

/**
* Starts to play the animation from the current position. Calling the play() method when the
Expand Down Expand Up @@ -219,5 +218,3 @@ PAG_API @interface PAGImageView : UIImageView
- (BOOL)flush;

@end

NS_ASSUME_NONNULL_END
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</data>
<key>Headers/PAGDecoder.h</key>
<data>
iycvUyfyMq4r9NcDe4E5rqOmpWo=
UErCrad780sSrXH6rt8Y+aqOsu0=
</data>
<key>Headers/PAGDiskCache.h</key>
<data>
Expand All @@ -42,7 +42,7 @@
</data>
<key>Headers/PAGImageView.h</key>
<data>
drNqDXrTEQFAE1zuEBaV54Ufnyo=
dSSBCVuUA8jQk9L1ZI/bqaB41eA=
</data>
<key>Headers/PAGLayer.h</key>
<data>
Expand Down Expand Up @@ -102,7 +102,7 @@
</data>
<key>Info.plist</key>
<data>
UA6V3gQvfRxlDd09oGpqi2FfUTs=
h3aUUf7Sw+pqOk5UnWh4mYsFY8k=
</data>
<key>Modules/module.modulemap</key>
<data>
Expand Down Expand Up @@ -136,7 +136,7 @@
<dict>
<key>hash2</key>
<data>
uoP36uOJreBqU7Wzdfvl7iuGt8aqqIbt7MUKsRSfPKE=
piLhonsU+oOVsvI9pyBe+vsnc5jhh6X+XpIMyOw6SdQ=
</data>
</dict>
<key>Headers/PAGDiskCache.h</key>
Expand Down Expand Up @@ -178,7 +178,7 @@
<dict>
<key>hash2</key>
<data>
NaHHlhE565SOmyTIPWeOJ11OWAMs3TjF5Mfy7G4kOlU=
dRSN6BDZ76pR1a7UujIT+9b0WkVlOHdvgJdwx6ZvJ1A=
</data>
</dict>
<key>Headers/PAGLayer.h</key>
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion libpag.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'libpag'
s.version = '4.3.65'
s.version = '4.4.13'
s.ios.deployment_target = '9.0'
s.summary = 'libpag SDK'
s.homepage = 'https://github.com/libpag/libpag-ios'
Expand Down

0 comments on commit 3f8c71c

Please sign in to comment.