Builds a MlImage
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.
Public Constructors
ByteBufferMlImageBuilder(ByteBuffer byteBuffer, int width, int height, int imageFormat)
Creates the builder with mandatory
ByteBuffer and the represented image. |
Public Methods
MlImage | |
ByteBufferMlImageBuilder |
setRotation(int rotation)
Sets value for
MlImage.getRotation() . |
Inherited Methods
Public Constructors
public ByteBufferMlImageBuilder (ByteBuffer byteBuffer, int width, int height, 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
.
Also calls setRotation(int)
to set the optional properties. If not set, the values
will be set with default:
- rotation: 0
Parameters
byteBuffer | image data object. |
---|---|
width | the width of the represented image. |
height | the height of the represented image. |
imageFormat | how the data encode the image. |
Public Methods
public ByteBufferMlImageBuilder setRotation (int rotation)
Sets value for MlImage.getRotation()
.
Parameters
rotation |
---|
Throws
IllegalArgumentException | if the rotation value is not 0, 90, 180 or 270. |
---|