java.lang.Object | |||
↳ | android.view.View | ||
↳ | android.view.TextureView | ||
↳ | org.libpag.PAGView |
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
interface | PAGView.PAGFlushListener | [Deprecated](Please use PAGViewListener's onAnimationUpdate instead.) PAG flush callback listener. | |||||||||
interface | PAGView.PAGViewListener |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.view.View
|
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.view.View
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
PAGView(Context context) | |||||||||||
PAGView(Context context, EGLContext sharedContext) | |||||||||||
PAGView(Context context, AttributeSet attrs) | |||||||||||
PAGView(Context context, AttributeSet attrs, int defStyleAttr) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
addListener(PAGView.PAGViewListener listener)
Adds a listener to the set of listeners that are sent events through the life of an
animation, such as start, repeat, and end.
| ||||||||||
void |
addPAGFlushListener(PAGView.PAGFlushListener listener)
[Deprecated](Please use PAGViewListener's onAnimationUpdate instead.)
Adds a PAGFlushListener to the set of listeners that are sent events when pag flush called.
| ||||||||||
boolean |
cacheEnabled()
If set to true, PAG renderer 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()
Call this method to render current position immediately.
| ||||||||||
void |
freeCache()
Free the cache created by the pag view 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 PAGView.
| ||||||||||
PAGComposition |
getComposition()
Returns the current PAGComposition for PAGView to render as content.
| ||||||||||
PAGLayer[] |
getLayersUnderPoint(float x, float y)
Returns an array of layers that lie under the specified point.
| ||||||||||
String |
getPath()
The path string of a pag file set by setPath().
| ||||||||||
double |
getProgress()
Returns the current progress of play position, the value is from 0.0 to 1.0.
| ||||||||||
boolean |
isPlaying()
Indicates whether the animation is playing.
| ||||||||||
boolean |
isSync()
Returns true if PAGView is playing in the main thread.
| ||||||||||
Bitmap |
makeSnapshot()
Returns a bitmap capturing the contents of the PAGView.
| ||||||||||
Matrix |
matrix()
Returns a copy of current matrix.
| ||||||||||
float |
maxFrameRate()
The maximum frame rate for rendering.
| ||||||||||
void |
onAnimationCancel(PAGAnimator animator)
Notifies the cancellation of the animation.
| ||||||||||
void |
onAnimationEnd(PAGAnimator animator)
Notifies the end of the animation.
| ||||||||||
void |
onAnimationRepeat(PAGAnimator animator)
Notifies the repetition of the animation.
| ||||||||||
void |
onAnimationStart(PAGAnimator animator)
Notifies the start of the animation.
| ||||||||||
void |
onAnimationUpdate(PAGAnimator animator)
Notifies another frame of the animation has occurred.
| ||||||||||
void | onResume() | ||||||||||
void | onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) | ||||||||||
boolean | onSurfaceTextureDestroyed(SurfaceTexture surface) | ||||||||||
void | onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int width, int height) | ||||||||||
void | onSurfaceTextureUpdated(SurfaceTexture surface) | ||||||||||
void | onVisibilityAggregated(boolean isVisible) | ||||||||||
void |
pause()
Cancels the animation at the current position.
| ||||||||||
void |
play()
Starts to play the animation from the current position.
| ||||||||||
void |
removeListener(PAGView.PAGViewListener listener)
Removes a listener from the set listening to this animation.
| ||||||||||
void |
removePAGFlushListener(PAGView.PAGFlushListener listener)
[Deprecated](Please use PAGViewListener's onAnimationUpdate instead.)
Removes a PAGFlushListener to the set of listeners that are sent events when pag flush
called.
| ||||||||||
int |
repeatCount()
The total number of times the animation is set to play.
| ||||||||||
int |
scaleMode()
Returns the current scale mode.
| ||||||||||
void | setBackgroundDrawable(Drawable background) | ||||||||||
void |
setCacheEnabled(boolean value)
Sets the value of cacheEnabled property.
| ||||||||||
void |
setCacheScale(float value)
Sets the value of cacheScale property.
| ||||||||||
void |
setComposition(PAGComposition newComposition)
Sets a new PAGComposition for PAGView to render as content.
| ||||||||||
void |
setMatrix(Matrix matrix)
Sets the transformation which will be applied to the composition.
| ||||||||||
void |
setMaxFrameRate(float value)
Sets the maximum frame rate for rendering.
| ||||||||||
boolean |
setPath(String path)
Loads a pag file from the specified path, returns false if the file does not exist or the
data is not a pag file.
| ||||||||||
void |
setPathAsync(String path, PAGFile.LoadListener listener)
Asynchronously load a pag file from the specific path.
| ||||||||||
void |
setProgress(double value)
Sets the progress of play position, the valid value is from 0.0 to 1.0.
| ||||||||||
void |
setRepeatCount(int repeatCount)
Set the number of times the animation to play.
| ||||||||||
void |
setScaleMode(int mode)
Specifies the rule of how to scale the pag content to fit the surface size.
| ||||||||||
void | setSurfaceTextureListener(TextureView.SurfaceTextureListener listener) | ||||||||||
void |
setSync(boolean isSync)
Sets the sync flag for the PAGView.
| ||||||||||
void |
setUseDiskCache(boolean value)
Set the value of useDiskCache property.
| ||||||||||
void |
setVideoEnabled(boolean enable)
Sets the value of videoEnabled property.
| ||||||||||
void |
stop()
Cancels the animation at the current position.
| ||||||||||
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, PAGView skips rendering for video composition.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void | onAttachedToWindow() | ||||||||||
void | onDetachedFromWindow() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.view.TextureView
| |||||||||||
From class
android.view.View
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
android.graphics.drawable.Drawable.Callback
| |||||||||||
From interface
android.view.KeyEvent.Callback
| |||||||||||
From interface
android.view.TextureView.SurfaceTextureListener
| |||||||||||
From interface
android.view.accessibility.AccessibilityEventSource
| |||||||||||
From interface
org.extra.tools.LifecycleListener
| |||||||||||
From interface
org.libpag.PAGAnimator.Listener
|
Adds a listener to the set of listeners that are sent events through the life of an animation, such as start, repeat, and end.
[Deprecated](Please use PAGViewListener's onAnimationUpdate instead.) Adds a PAGFlushListener to the set of listeners that are sent events when pag flush called. the listener onFlush is called on main thread.
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.
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.
Call this method to render current position immediately. Note that all the changes previously made to the PAGView will only take effect after this method is called. If the play() method is already called, there is no need to call it manually since it will be automatically called every frame. Returns true if the content has changed.
Free the cache created by the pag view immediately. Can be called to reduce memory pressure.
Returns a rectangle in pixels that defines the displaying area of the specified layer, which is in the coordinate of the PAGView.
Returns the current PAGComposition for PAGView to render as content.
Returns an array of layers that lie under the specified point. The point is in pixels not dp.
The path string of a pag file set by setPath().
Returns the current progress of play position, the value is from 0.0 to 1.0.
Indicates whether the animation is playing.
Returns true if PAGView is playing in the main thread. The default value is false.
Returns a bitmap capturing the contents of the PAGView. Subsequent rendering of the PAGView will not be captured. Returns null if the PAGView hasn't been presented yet.
Returns a copy of current matrix.
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.
Notifies the cancellation of the animation. It can be called from either the UI thread or the thread that calls the cancel() method.
Notifies the end of the animation. It can only be called from the UI thread.
Notifies the repetition of the animation. It can only be called from the UI thread.
Notifies the start of the animation. It can be called from either the UI thread or the thread that calls the start() method.
Notifies another frame of the animation has occurred. It may be called from an arbitrary thread if the animation is running asynchronously.
Cancels the animation at the current position. Calling the play() method can resume the animation from the last paused position.
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.
Removes a listener from the set listening to this animation.
[Deprecated](Please use PAGViewListener's onAnimationUpdate instead.) Removes a PAGFlushListener to the set of listeners that are sent events when pag flush called. The listener onFlush is called on main thread.
The total number of times the animation is set to play. The default is 1, which means the animation will play only once. If the repeat count is set to 0 or a negative value, the animation will play infinity times.
Returns the current scale mode.
Sets the value of cacheEnabled property.
Sets the value of cacheScale property.
Sets a new PAGComposition for PAGView to render as content. Note that if the composition is already added to another PAGView, it will be removed from the previous PAGView.
Sets the transformation which will be applied to the composition. The scaleMode property will be set to PAGScaleMode::None when this method is called.
Sets the maximum frame rate for rendering.
Loads a pag file from the specified path, returns false if the file does not exist or the data is not a pag file. The path starts with "assets://" means that it is located in assets directory. Note: All PAGFiles loaded by the same path share the same internal cache. The internal cache remains alive until all PAGFiles are released. Use 'PAGFile.Load(byte[])' instead if you don't want to load a PAGFile from the internal caches.
Asynchronously load a pag file from the specific path.
Sets the progress of play position, the valid value is from 0.0 to 1.0.
Set the number of times the animation to play.
Specifies the rule of how to scale the pag content to fit the surface size. The matrix changes when this method is called.
Sets the sync flag for the PAGView.
Set the value of useDiskCache property.
Sets the value of videoEnabled property.
Cancels the animation at the current position. Currently, it has the same effect as pause().
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, PAGView skips rendering for video composition.