BitmapMlImageBuilder

public class BitmapMlImageBuilder

Builds MlImage from Bitmap.

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

Use BitmapExtractor to get Bitmap you passed in.

Public Constructors

BitmapMlImageBuilder(Bitmap bitmap)
Creates the builder with a mandatory Bitmap.
BitmapMlImageBuilder(Context context, Uri uri)
Creates the builder to build MlImage from a file.

Public Methods

MlImage
build()
Builds an MlImage instance.
BitmapMlImageBuilder
setRotation(int rotation)
Sets value for MlImage.getRotation().

Inherited Methods

Public Constructors

public BitmapMlImageBuilder (Bitmap bitmap)

Creates the builder with a mandatory Bitmap.

Also calls setRotation(int) to set the optional properties. If not set, the values will be set with default:

  • rotation: 0

Parameters
bitmap image data object.

public BitmapMlImageBuilder (Context context, Uri uri)

Creates the builder to build MlImage from a file.

Also calls setRotation(int) to set the optional properties. If not set, the values will be set with default:

  • rotation: 0

Parameters
context the application context.
uri the path to the resource file.
Throws
IOException

Public Methods

public MlImage build ()

Builds an MlImage instance.

public BitmapMlImageBuilder setRotation (int rotation)

Sets value for MlImage.getRotation().

Parameters
rotation
Throws
IllegalArgumentException if the rotation value is not 0, 90, 180 or 270.