MPImage

public class MPImage

The wrapper class for image objects.

MPImage is designed to be an immutable image container, which could be shared cross-platforms.

To construct a MPImage, use the provided builders:

MPImage uses reference counting to maintain internal storage. When it is created the reference count is 1. Developer can call close() to reduce reference count to release internal storage earlier, otherwise Java garbage collection will release the storage eventually.

To extract concrete image, first check MPImage.StorageType and then use the provided extractors:

Nested Classes

@interface MPImage.MPImageFormat Specifies the image format of an image. 
@interface MPImage.StorageType Specifies the image container type. 

Constants

Public Methods

synchronized void
close()
Removes a reference that was previously acquired or init.
List<MPImageProperties>
getContainedImageProperties()
Returns a list of supported image properties for this MPImage.
int
getHeight()
Returns the height of the image.
int
getWidth()
Returns the width of the image.

Inherited Methods

boolean
equals(Object arg0)
final Class<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()
abstract void
close()
abstract void
close()

Constants

public static final int IMAGE_FORMAT_ALPHA

Constant Value: 8

public static final int IMAGE_FORMAT_JPEG

Constant Value: 9

public static final int IMAGE_FORMAT_NV12

Constant Value: 3

public static final int IMAGE_FORMAT_NV21

Constant Value: 4

public static final int IMAGE_FORMAT_RGB

Constant Value: 2

public static final int IMAGE_FORMAT_RGBA

Constant Value: 1

public static final int IMAGE_FORMAT_UNKNOWN

Constant Value: 0

public static final int IMAGE_FORMAT_VEC32F1

Constant Value: 10

public static final int IMAGE_FORMAT_VEC32F2

Constant Value: 11

public static final int IMAGE_FORMAT_YUV_420_888

Constant Value: 7

public static final int IMAGE_FORMAT_YV12

Constant Value: 5

public static final int IMAGE_FORMAT_YV21

Constant Value: 6

public static final int STORAGE_TYPE_BITMAP

Constant Value: 1

public static final int STORAGE_TYPE_BYTEBUFFER

Constant Value: 2

public static final int STORAGE_TYPE_IMAGE_PROXY

Constant Value: 4

public static final int STORAGE_TYPE_MEDIA_IMAGE

Constant Value: 3

Public Methods

public synchronized void close ()

Removes a reference that was previously acquired or init.

When MPImage is created, it has 1 reference count.

When the reference count becomes 0, it will release the resource under the hood.

public List<MPImageProperties> getContainedImageProperties ()

Returns a list of supported image properties for this MPImage.

Currently MPImage only support single storage type so the size of return list will always be 1.

public int getHeight ()

Returns the height of the image.

public int getWidth ()

Returns the width of the image.