public class

PAGImage

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

Summary

Public Methods
static PAGImage FromAssets(AssetManager manager, String fileName)
Load a pag file from assets, returns null if the file does not exist or the data is not a pag file.
static PAGImage FromBitmap(Bitmap bitmap)
Creates a PAGImage object from an android.graphics.Bitmap object, return null if it's not valid Bitmap.
static PAGImage FromBytes(byte[] bytes)
Creates a PAGImage object from the specified byte data, return null if the bytes is empty or it's not a valid image file.
static PAGImage FromPath(String path)
Creates a PAGImage object from a path of a image file, return null if the file does not exist or it's not a valid image file.
static PAGImage FromTexture(int textureID, int textureTarget, int width, int height, boolean flipY)
Creates a PAGImage object from the specified OpenGL texture ID, returns null if the texture is invalid or there is no current openGL context.
static PAGImage FromTexture(int textureID, int textureTarget, int width, int height)
Creates a PAGImage object from the specified OpenGL texture ID, returns null if the texture is invalid or there is no current openGL context.
int height()
Returns the height in pixels of the image.
Matrix matrix()
Returns a copy of current matrix.
void release()
Free up resources used by the PAGImage 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 setMatrix(Matrix matrix)
Set the transformation which will be applied to the image content.
void setScaleMode(int mode)
Specifies the rule of how to scale the image content to fit the original image size.
int width()
Returns the width in pixels of the image.
Protected Methods
void finalize()
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static PAGImage FromAssets (AssetManager manager, String fileName)

Load a pag file from assets, returns null if the file does not exist or the data is not a pag file.

public static PAGImage FromBitmap (Bitmap bitmap)

Creates a PAGImage object from an android.graphics.Bitmap object, return null if it's not valid Bitmap.

public static PAGImage FromBytes (byte[] bytes)

Creates a PAGImage object from the specified byte data, return null if the bytes is empty or it's not a valid image file.

public static PAGImage FromPath (String path)

Creates a PAGImage object from a path of a image file, return null if the file does not exist or it's not a valid image file.

public static PAGImage FromTexture (int textureID, int textureTarget, int width, int height, boolean flipY)

Creates a PAGImage object from the specified OpenGL texture ID, returns null if the texture is invalid or there is no current openGL context. Note: 1. The caller must make sure that the texture outlive the lifetime of the returned PAGImage object. 2. The current openGL context should be the same as the shareContext parameter of FromSurfaceTexture(SurfaceTexture, EGLContext) or the context which PAGSurface.FromTexture() uses, so that the returned PAGImage object can be drawn on to that PAGSurface. 3. The caller can use fence sync objects to synchronise texture content (see flushAndFenceSync(long[]) and waitSync(long)).

Parameters
textureID the id of the texture.
textureTarget either GL_TEXTURE_EXTERNAL_OES or GL_TEXTURE_2D.
width the width of the texture.
height the height of the texture.
flipY indicates the origin of the texture, true means 'bottom-left', false means 'top-left'.

public static PAGImage FromTexture (int textureID, int textureTarget, int width, int height)

Creates a PAGImage object from the specified OpenGL texture ID, returns null if the texture is invalid or there is no current openGL context. Note: 1. The caller must make sure that the texture outlive the lifetime of the returned PAGImage object. 2. The current openGL context should be the same as the shareContext parameter of FromSurfaceTexture(SurfaceTexture, EGLContext) or the context which PAGSurface.FromTexture() uses, so that the returned PAGImage object can be drawn on to that PAGSurface. 3. The caller can use fence sync objects to synchronise texture content (see flushAndFenceSync(long[]) and waitSync(long)).

Parameters
textureID the id of the texture.
textureTarget either GL_TEXTURE_EXTERNAL_OES or GL_TEXTURE_2D.
width the width of the texture.
height the height of the texture.

public int height ()

Returns the height in pixels of the image.

public Matrix matrix ()

Returns a copy of current matrix.

public void release ()

Free up resources used by the PAGImage 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 setMatrix (Matrix matrix)

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

public void setScaleMode (int mode)

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

public int width ()

Returns the width in pixels of the image.

Protected Methods

protected void finalize ()