PAGView Class Reference
| Inherits from | UIView |
|---|---|
| Declared in | PAGView.h |
– addListener:
Adds a listener to the set of listeners that are sent events through the life of an animation, such as start, repeat, and end. PAGView only holds a weak reference to the listener.
- (void)addListener:(id<PAGViewListener>)listenerDeclared In
PAGView.h
– removeListener:
Removes a listener from the set listening to this animation.
- (void)removeListener:(id<PAGViewListener>)listenerDeclared In
PAGView.h
– sync
Indicates whether the animation is allowed to run in the UI thread. The default value is NO. Regardless of whether the animation runs asynchronously, all listener callbacks will be called on the UI thread.
- (BOOL)syncDeclared In
PAGView.h
– setSync:
Set whether the animation is allowed to run in the UI thread.
- (void)setSync:(BOOL)valueDeclared In
PAGView.h
– setRepeatCount:
Set the number of times the animation to play.
- (void)setRepeatCount:(int)repeatCountDeclared In
PAGView.h
– play
Starts to play the animation from the current position. Calling the play() method when the animation is already playing has no effect. The play() method does not alter the animation’s current position. However, if the animation previously reached its end, it will restart from the beginning.
- (void)playDeclared In
PAGView.h
– pause
Cancels the animation at the current position. Calling the play() method can resume the animation from the last paused position.
- (void)pauseDeclared In
PAGView.h
– stop
Cancels the animation at the current position. Currently, it has the same effect as pause().
- (void)stopDeclared In
PAGView.h
– setPath:
Load a pag file from the specified path, returns false if the file does not exist or the data is not a pag file. Note: All PAGFiles loaded by the same path share the same internal cache. The internal cache is alive until all PAGFiles are released. Use ‘[PAGFile Load:size:]’ instead if you don’t want to load a PAGFile from the internal caches.
- (BOOL)setPath:(NSString *)filePathDeclared In
PAGView.h
– getComposition
Returns the current PAGComposition for PAGView to render as content.
- (PAGComposition *)getCompositionDeclared In
PAGView.h
– setComposition:
Sets a new PAGComposition for PAGView to render as content. Note: If the composition is already added to another PAGView, it will be removed from the previous PAGView.
- (void)setComposition:(PAGComposition *)newCompositionDeclared In
PAGView.h
– videoEnabled
Return the value of videoEnabled property.
- (BOOL)videoEnabledDeclared In
PAGView.h
– setVideoEnabled:
If set false, will skip video layer drawing.
- (void)setVideoEnabled:(BOOL)enableDeclared In
PAGView.h
– cacheEnabled
If set to true, PAG renderer caches an internal bitmap representation of the static content for each layer. This caching can increase performance for layers that contain complex vector content. The execution speed can be significantly faster depending on the complexity of the content, but it requires extra graphics memory. The default value is true.
- (BOOL)cacheEnabledDeclared In
PAGView.h
– useDiskCache
If set to true, PAG will cache the associated rendering data into a disk file, such as the decoded image frames of video compositions. This can help reduce memory usage and improve rendering performance.
- (BOOL)useDiskCacheDeclared In
PAGView.h
– cacheScale
This value defines the scale factor for internal graphics caches, ranges from 0.0 to 1.0. The scale factors less than 1.0 may result in blurred output, but it can reduce the usage of graphics memory which leads to better performance. The default value is 1.0.
- (float)cacheScaleDeclared In
PAGView.h
– maxFrameRate
The maximum frame rate for rendering. If set to a value less than the actual frame rate from PAGFile, it drops frames but increases performance. Otherwise, it has no effect. The default value is 60.
- (float)maxFrameRateDeclared In
PAGView.h
– setMaxFrameRate:
Set the maximum frame rate for rendering.
- (void)setMaxFrameRate:(float)valueDeclared In
PAGView.h
– setScaleMode:
Specifies the rule of how to scale the pag content to fit the surface size. The matrix changes when this method is called.
- (void)setScaleMode:(PAGScaleMode)valueDeclared In
PAGView.h
– setMatrix:
Set the transformation which will be applied to the composition. The method is valid only when the scaleMode is PAGScaleMode.None.
- (void)setMatrix:(CGAffineTransform)valueDeclared In
PAGView.h
– duration
The duration of current composition in microseconds.
- (int64_t)durationDeclared In
PAGView.h
– getProgress
Returns the current progress of play position, the value is from 0.0 to 1.0. It is applied only when the composition is not null.
- (double)getProgressDeclared In
PAGView.h
– setProgress:
Set the progress of play position, the value is from 0.0 to 1.0.
- (void)setProgress:(double)valueDeclared In
PAGView.h
– flush
Call this method to render current position immediately. Note that all the changes previously made to the PAGView will only take effect after this method is called. If the play() method is already called, there is no need to call it manually since it will be automatically called every frame. Returns true if the content has changed.
- (BOOL)flushDeclared In
PAGView.h
– getLayersUnderPoint:
Returns an array of layers that lie under the specified point. The point is in pixels, convert dp to pixel by multiply [UIScreen mainScreen].scale, eg: point.x * scale,point.y* scale.
- (NSArray<PAGLayer*> *)getLayersUnderPoint:(CGPoint)pointDeclared In
PAGView.h
– freeCache
Free the cache created by the pag view immediately. Can be called to reduce memory pressure.
- (void)freeCacheDeclared In
PAGView.h
– makeSnapshot
Returns a CVPixelBuffer object capturing the contents of the PAGView. Subsequent rendering of the PAGView will not be captured. Returns nil if the PAGView hasn’t been presented yet.
- (CVPixelBufferRef)makeSnapshotDeclared In
PAGView.h
– getBounds:
Returns a rectangle in pixels that defines the displaying area of the specified layer, which is in the coordinate of the PAGView.
- (CGRect)getBounds:(PAGLayer *)pagLayerDeclared In
PAGView.h