PAGPlayer Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | PAGPlayer.h |
– getComposition
Returns the current PAGComposition for PAGPlayer to render as content.
- (PAGComposition *)getCompositionDeclared In
PAGPlayer.h
– setComposition:
Sets a new PAGComposition for PAGPlayer to render as content. Note: If the composition is already added to another PAGPlayer, it will be removed from the previous PAGPlayer.
- (void)setComposition:(PAGComposition *)newCompositionDeclared In
PAGPlayer.h
– getSurface
Returns the PAGSurface object for PAGPlayer to render onto.
- (PAGSurface *)getSurfaceDeclared In
PAGPlayer.h
– setSurface:
Set the PAGSurface object for PAGPlayer to render onto.
- (void)setSurface:(PAGSurface *)surfaceDeclared In
PAGPlayer.h
– videoEnabled
If set to false, the player skips rendering for video composition.
- (BOOL)videoEnabledDeclared In
PAGPlayer.h
– cacheEnabled
If set to true, PAGPlayer 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
PAGPlayer.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
PAGPlayer.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
PAGPlayer.h
– maxFrameRate
The maximum frame rate for rendering, ranges from 1 to 60. If set to a value less than the actual frame rate from composition, it drops frames but increases performance. Otherwise, it has no effect. The default value is 60.
- (float)maxFrameRateDeclared In
PAGPlayer.h
– setMaxFrameRate:
Set the maximum frame rate for rendering.
- (void)setMaxFrameRate:(float)valueDeclared In
PAGPlayer.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
PAGPlayer.h
– setMatrix:
Set the transformation which will be applied to the composition. The scaleMode property will be set to PAGScaleMode::None when this method is called.
- (void)setMatrix:(CGAffineTransform)valueDeclared In
PAGPlayer.h
– duration
The duration of current composition in microseconds.
- (int64_t)durationDeclared In
PAGPlayer.h
– getProgress
Returns the current progress of play position, the value is from 0.0 to 1.0.
- (double)getProgressDeclared In
PAGPlayer.h
– setProgress:
Set the progress of play position, the value is from 0.0 to 1.0.
- (void)setProgress:(double)valueDeclared In
PAGPlayer.h
– prepare
Prepares the player for the next flush() call. It collects all CPU tasks from the current progress of the composition and runs them asynchronously in parallel. It is usually used for speeding up the first frame rendering.
- (void)prepareDeclared In
PAGPlayer.h
– flush
Apply all pending changes to the target surface immediately. Returns true if the content has changed.
- (BOOL)flushDeclared In
PAGPlayer.h
– getBounds:
Returns a rectangle in pixels that defines the displaying area of the specified layer, which is in the coordinate of the PAGSurface.
- (CGRect)getBounds:(PAGLayer *)pagLayerDeclared In
PAGPlayer.h
– getLayersUnderPoint:
Returns an array of layers that lie under the specified point. The point is in pixels and from the surface’s coordinates.
- (NSArray<PAGLayer*> *)getLayersUnderPoint:(CGPoint)pointDeclared In
PAGPlayer.h
– hitTestPoint:point:
Evaluates the PAGLayer to see if it overlaps or intersects with the specified point. The point is in the coordinate space of the PAGSurface, not the PAGComposition that contains the PAGLayer. It always returns false if the PAGLayer or its parent (or parent’s parent…) has not been added to this PAGPlayer. This method only check against the bounding box not the acual pixels.
- (BOOL)hitTestPoint:(PAGLayer *)layer point:(CGPoint)pointDeclared In
PAGPlayer.h
– hitTestPoint:point:pixelHitTest:
Evaluates the PAGLayer to see if it overlaps or intersects with the specified point. The point is in the coordinate space of the PAGSurface, not the PAGComposition that contains the PAGLayer. It always returns false if the PAGLayer or its parent (or parent’s parent…) has not been added to this PAGPlayer. The pixelHitTest parameter indicates whether or not to check against the actual pixels of the object (true) or the bounding box (false). Returns true if the PAGLayer overlaps or intersects with the specified point.
- (BOOL)hitTestPoint:(PAGLayer *)layer point:(CGPoint)point pixelHitTest:(BOOL)pixelHitTestDeclared In
PAGPlayer.h