PAGPlayer Class Reference

Inherits from NSObject
Declared in PAGPlayer.h

– getComposition

Returns the current PAGComposition for PAGPlayer to render as content.

- (PAGComposition *)getComposition

Declared 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 *)newComposition

Declared In

PAGPlayer.h

– getSurface

Returns the PAGSurface object for PAGPlayer to render onto.

- (PAGSurface *)getSurface

Declared In

PAGPlayer.h

– setSurface:

Set the PAGSurface object for PAGPlayer to render onto.

- (void)setSurface:(PAGSurface *)surface

Declared In

PAGPlayer.h

– videoEnabled

If set to false, the player skips rendering for video composition.

- (BOOL)videoEnabled

Declared In

PAGPlayer.h

– setVideoEnabled:

Set the value of videoEnabled property.

- (void)setVideoEnabled:(BOOL)value

Declared 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)cacheEnabled

Declared In

PAGPlayer.h

– setCacheEnabled:

Set the value of cacheEnabled property.

- (void)setCacheEnabled:(BOOL)value

Declared 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)useDiskCache

Declared In

PAGPlayer.h

– setUseDiskCache:

Set the value of useDiskCache property.

- (void)setUseDiskCache:(BOOL)value

Declared 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)cacheScale

Declared In

PAGPlayer.h

– setCacheScale:

Set the value of cacheScale property.

- (void)setCacheScale:(float)value

Declared 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)maxFrameRate

Declared In

PAGPlayer.h

– setMaxFrameRate:

Set the maximum frame rate for rendering.

- (void)setMaxFrameRate:(float)value

Declared In

PAGPlayer.h

– scaleMode

Returns the current scale mode.

- (PAGScaleMode)scaleMode

Declared 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)value

Declared In

PAGPlayer.h

– matrix

Returns a copy of current matrix.

- (CGAffineTransform)matrix

Declared 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)value

Declared In

PAGPlayer.h

– duration

The duration of current composition in microseconds.

- (int64_t)duration

Declared In

PAGPlayer.h

– getProgress

Returns the current progress of play position, the value is from 0.0 to 1.0.

- (double)getProgress

Declared In

PAGPlayer.h

– setProgress:

Set the progress of play position, the value is from 0.0 to 1.0.

- (void)setProgress:(double)value

Declared In

PAGPlayer.h

– currentFrame

Returns the current frame.

- (int64_t)currentFrame

Declared 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)prepare

Declared In

PAGPlayer.h

– flush

Apply all pending changes to the target surface immediately. Returns true if the content has changed.

- (BOOL)flush

Declared 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 *)pagLayer

Declared 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)point

Declared 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)point

Declared 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)pixelHitTest

Declared In

PAGPlayer.h