PAGView Class Reference
Inherits from | NSView |
---|---|
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>)listener
Declared In
PAGView.h
– removeListener:
Removes a listener from the set listening to this animation.
- (void)removeListener:(id<PAGViewListener>)listener
Declared In
PAGView.h
– setRepeatCount:
Set the number of times the animation to play.
- (void)setRepeatCount:(int)repeatCount
Declared 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)play
Declared 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)pause
Declared In
PAGView.h
– stop
Cancels the animation at the current position. Currently, it has the same effect as pause().
- (void)stop
Declared 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 intenal caches.
- (BOOL)setPath:(NSString *)filePath
Declared In
PAGView.h
– getComposition
Returns the current PAGComposition for PAGView to render as content.
- (PAGComposition *)getComposition
Declared 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 *)newComposition
Declared In
PAGView.h
– videoEnabled
Return the value of videoEnabled property.
- (BOOL)videoEnabled
Declared In
PAGView.h
– setVideoEnabled:
If set false, will skip video layer drawing.
- (void)setVideoEnabled:(BOOL)enable
Declared 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)cacheEnabled
Declared 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)cacheScale
Declared 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)maxFrameRate
Declared In
PAGView.h
– setMaxFrameRate:
Set the maximum frame rate for rendering.
- (void)setMaxFrameRate:(float)value
Declared 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)value
Declared 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)value
Declared In
PAGView.h
– duration
The duration of current composition in microseconds.
- (int64_t)duration
Declared 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)getProgress
Declared In
PAGView.h
– setProgress:
Set the progress of play position, the value is from 0.0 to 1.0.
- (void)setProgress:(double)value
Declared In
PAGView.h
– flush
Call this method to render current position immediately. If the play() method is already called, there is no need to call it. Returns true if the content has changed.
- (BOOL)flush
Declared 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)point
Declared In
PAGView.h
– freeCache
Free the cache created by the pag view immediately. Can be called to reduce memory pressure.
- (void)freeCache
Declared 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)makeSnapshot
Declared 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 *)pagLayer
Declared In
PAGView.h