Package com.digimarc.capture.camera
Class BitmapUtils
java.lang.Object
com.digimarc.capture.camera.BitmapUtils
This class provides a series of utility methods for handling camera frames. These methods can be used for converting,
rotating and scaling the image data returned in
ReaderResult
objects.-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic android.graphics.Bitmap
Convert the supplied image into a bitmap.static android.graphics.Bitmap
convertRawImageToBitmap
(ImageFrame frame, int surfaceRotation) Convert the supplied image into a bitmap.static android.graphics.Bitmap
createScaledBitmap
(android.graphics.Bitmap unscaledBitmap, int dstWidth, int dstHeight, BitmapUtils.SCALING_LOGIC scalingLogic) Create a scaled version of the supplied bitmapstatic android.graphics.Bitmap
rotateBitmap
(android.graphics.Bitmap sourceBitmap, float degree) Rotate the supplied bitmap.
-
Constructor Details
-
BitmapUtils
public BitmapUtils()
-
-
Method Details
-
createScaledBitmap
@Nullable public static android.graphics.Bitmap createScaledBitmap(@NonNull android.graphics.Bitmap unscaledBitmap, int dstWidth, int dstHeight, @NonNull BitmapUtils.SCALING_LOGIC scalingLogic) Create a scaled version of the supplied bitmap- Parameters:
unscaledBitmap
- Source bitmap imagedstWidth
- Requested width for the scaled bitmapdstHeight
- Requested height for the scaled bitmapscalingLogic
- How should the scaling be performed.- Returns:
- A new bitmap matching the supplied size parameters, or null if the operation failed.
-
rotateBitmap
@Nullable public static android.graphics.Bitmap rotateBitmap(@NonNull android.graphics.Bitmap sourceBitmap, float degree) Rotate the supplied bitmap.- Parameters:
sourceBitmap
- Bitmapdegree
- Rotation degrees- Returns:
- Rotated bitmap or null if the operation failed.
-
convertRawImageToBitmap
Convert the supplied image into a bitmap. The bitmap will have the same dimensions as provided image frame.- Parameters:
frame
- Image data.- Returns:
- A bitmap object.
-
convertRawImageToBitmap
@Nullable public static android.graphics.Bitmap convertRawImageToBitmap(@NonNull ImageFrame frame, int surfaceRotation) Convert the supplied image into a bitmap. The converted image will be rotated according to the surfaceRotation parameter. The bitmap will have the same dimensions as provided image frame.- Parameters:
frame
- Image data.surfaceRotation
- Image rotation.- Returns:
- A bitmap object.
-