Utility for extracting ByteBuffer
from MPImage
.
Currently it only supports MPImage
with MPImage.STORAGE_TYPE_BYTEBUFFER
,
otherwise IllegalArgumentException
will be thrown.
Public Methods
static ByteBuffer | |
static ByteBuffer |
Inherited Methods
Public Methods
public static ByteBuffer extract (MPImage image)
Extracts a ByteBuffer
from a MPImage
.
The returned ByteBuffer
is a read-only view, with the first available MPImageProperties
whose storage type is MPImage.STORAGE_TYPE_BYTEBUFFER
.
Parameters
image |
---|
Returns
- A read-only
ByteBuffer
.
Throws
IllegalArgumentException | when the image doesn't contain a ByteBuffer storage.
|
---|
public static ByteBuffer extract (MPImage image, int targetFormat)
Extracts a readonly ByteBuffer
in given targetFormat
from a MPImage
.
Format conversion spec:
- When extracting RGB images to RGBA format, A channel will always set to 255.
- When extracting RGBA images to RGB format, A channel will be dropped.
Parameters
image | the image to extract buffer from. |
---|---|
targetFormat | the image format of the result bytebuffer. |
Returns
- the readonly
ByteBuffer
stored inMPImage
Throws
IllegalArgumentException | when the extraction requires unsupported format or data type conversions. |
---|