ByteBufferImageBuilder

public class ByteBufferImageBuilder


Builds a MPImage from a ByteBuffer.

You can pass in either mutable or immutable ByteBuffer. However once ByteBuffer is passed in, to keep data integrity you shouldn't modify content in it.

Use ByteBufferExtractor to get ByteBuffer you passed in.

Summary

Public constructors

ByteBufferImageBuilder(
    ByteBuffer byteBuffer,
    int width,
    int height,
    @MPImage.MPImageFormat int imageFormat
)

Creates the builder with mandatory ByteBuffer and the represented image.

Public methods

MPImage

Builds a MPImage instance.

Public constructors

ByteBufferImageBuilder

public ByteBufferImageBuilder(
    ByteBuffer byteBuffer,
    int width,
    int height,
    @MPImage.MPImageFormat int imageFormat
)

Creates the builder with mandatory ByteBuffer and the represented image.

We will validate the size of the byteBuffer with given width, height and imageFormat.

Parameters
ByteBuffer byteBuffer

image data object.

int width

the width of the represented image.

int height

the height of the represented image.

@MPImage.MPImageFormat int imageFormat

how the data encode the image.

Public methods

build

public MPImage build()

Builds a MPImage instance.