java.lang.Object | |
↳ | org.libpag.PAGPlayer |
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
|
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.
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.
Returns the current frame.
The duration of current composition in microseconds.
Apply all pending changes to the target surface immediately. Returns true if the content has changed.
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.
Returns a rectangle in pixels that defines the displaying area of the specified layer, which is in the coordinate of the PAGSurface.
Returns the current PAGComposition for PAGPlayer to render as content.
Returns an array of layers that lie under the specified point. The point is in pixels and from the surface's coordinates.
Returns the current progress of play position, the value is from 0.0 to 1.0.
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.
Returns a copy of current matrix.
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.
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.
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.
Returns the current scale mode.
Set the value of cacheEnabled property.
Set the value of cacheScale property.
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.
Sets the transformation which will be applied to the composition. The scaleMode property will be set to PAGScaleMode::None when this method is called.
Set the maximum frame rate for rendering.
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.
Specifies the rule of how to scale the pag content to fit the surface size. The matrix changes when this method is called.
Set the value of useDiskCache property.
Set the value of videoEnabled property.
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.
If set to false, the player skips rendering for video composition.
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