public class

PAGPlayer

extends Object
java.lang.Object
   ↳ org.libpag.PAGPlayer

Summary

Public Constructors
PAGPlayer()
Public Methods
boolean cacheEnabled()
If set to true, PAGPlayer caches an internal bitmap representation of the static content for each layer.
float cacheScale()
This value defines the scale factor for internal graphics caches, ranges from 0.0 to 1.0.
long currentFrame()
Returns the current frame.
long duration()
The duration of current composition in microseconds.
boolean flush()
Apply all pending changes to the target surface immediately.
boolean flushAndFenceSync(long[] sync)
Apply all pending changes to the target surface immediately.
RectF getBounds(PAGLayer pagLayer)
Returns a rectangle in pixels that defines the displaying area of the specified layer, which is in the coordinate of the PAGSurface.
PAGComposition getComposition()
Returns the current PAGComposition for PAGPlayer to render as content.
PAGLayer[] getLayersUnderPoint(float surfaceX, float surfaceY)
Returns an array of layers that lie under the specified point.
double getProgress()
Returns the current progress of play position, the value is from 0.0 to 1.0.
PAGSurface getSurface()
Returns the PAGSurface object for PAGPlayer to render onto.
boolean hitTestPoint(PAGLayer pagLayer, float surfaceX, float surfaceY, boolean pixelHitTest)
Evaluates the PAGLayer to see if it overlaps or intersects with the specified point.
Matrix matrix()
Returns a copy of current matrix.
float maxFrameRate()
The maximum frame rate for rendering, ranges from 1 to 60.
void prepare()
Prepares the player for the next flush() call.
void release()
Free up resources used by the PAGPlayer instance immediately instead of relying on the garbage collector to do this for you at some point in the future.
int scaleMode()
Returns the current scale mode.
void setCacheEnabled(boolean value)
Set the value of cacheEnabled property.
void setCacheScale(float value)
Set the value of cacheScale property.
void setComposition(PAGComposition newComposition)
Sets a new PAGComposition for PAGPlayer to render as content.
void setMatrix(Matrix matrix)
Sets the transformation which will be applied to the composition.
void setMaxFrameRate(float value)
Set the maximum frame rate for rendering.
void setProgress(double value)
Sets the progress of play position, the value ranges from 0.0 to 1.0.
void setScaleMode(int mode)
Specifies the rule of how to scale the pag content to fit the surface size.
void setSurface(PAGSurface surface)
Set the PAGSurface object for PAGPlayer to render onto.
void setUseDiskCache(boolean value)
Set the value of useDiskCache property.
void setVideoEnabled(boolean value)
Set the value of videoEnabled property.
boolean 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.
boolean videoEnabled()
If set to false, the player skips rendering for video composition.
boolean waitSync(long sync)
Inserts a sync object that the OpenGL API must wait on before executing any more commands on the GPU for this surface.
Protected Methods
void finalize()
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public PAGPlayer ()

Public Methods

public boolean 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.

public float 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.

public long currentFrame ()

Returns the current frame.

public long duration ()

The duration of current composition in microseconds.

public boolean flush ()

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

public boolean flushAndFenceSync (long[] sync)

Apply all pending changes to the target surface immediately. Returns true if the content has changed. If the sync array is not null, a new sync object will be created and set at the index 0. After issuing all commands, the sync object will be signaled by the GPU. The caller must delete the sync object returned by this method. If the sync object is 0, the OpenGL did not create or add a sync object to signal on the GPU, the caller should not instruct the GPU to wait on the sync object.

public RectF getBounds (PAGLayer pagLayer)

Returns a rectangle in pixels that defines the displaying area of the specified layer, which is in the coordinate of the PAGSurface.

public PAGComposition getComposition ()

Returns the current PAGComposition for PAGPlayer to render as content.

public PAGLayer[] getLayersUnderPoint (float surfaceX, float surfaceY)

Returns an array of layers that lie under the specified point. The point is in pixels and from the surface's coordinates.

public double getProgress ()

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

public PAGSurface getSurface ()

Returns the PAGSurface object for PAGPlayer to render onto.

public boolean hitTestPoint (PAGLayer pagLayer, float surfaceX, float surfaceY, boolean 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.

public Matrix matrix ()

Returns a copy of current matrix.

public float 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.

public void 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.

public void release ()

Free up resources used by the PAGPlayer instance immediately instead of relying on the garbage collector to do this for you at some point in the future.

public int scaleMode ()

Returns the current scale mode.

public void setCacheEnabled (boolean value)

Set the value of cacheEnabled property.

public void setCacheScale (float value)

Set the value of cacheScale property.

public void setComposition (PAGComposition newComposition)

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.

public void setMatrix (Matrix matrix)

Sets the transformation which will be applied to the composition. The scaleMode property will be set to PAGScaleMode::None when this method is called.

public void setMaxFrameRate (float value)

Set the maximum frame rate for rendering.

public void setProgress (double value)

Sets the progress of play position, the value ranges from 0.0 to 1.0. It is applied only when the composition is not null.

public void setScaleMode (int mode)

Specifies the rule of how to scale the pag content to fit the surface size. The matrix changes when this method is called.

public void setSurface (PAGSurface surface)

Set the PAGSurface object for PAGPlayer to render onto.

public void setUseDiskCache (boolean value)

Set the value of useDiskCache property.

public void setVideoEnabled (boolean value)

Set the value of videoEnabled property.

public boolean 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.

public boolean videoEnabled ()

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

public boolean waitSync (long sync)

Inserts a sync object that the OpenGL API must wait on before executing any more commands on the GPU for this surface. PAG will take ownership of the sync object and delete it once it has been signaled and waited on. If this call returns false, then the GPU will not wait on the passed sync object, and the client will still own the sync object. Usually called before flush() and @flushAndFenceSync(long[]) Returns true if GPU is waiting on sync object

Protected Methods

protected void finalize ()