BitmapUtil
@UnstableApi
public final class BitmapUtil
Utility methods for Bitmap instances.
Summary
Public methods |
|
|---|---|
static Bitmap |
decode(Decodes a |
static Bitmap |
makeShared(Bitmap bitmap)Returns a immutable, sharable version of |
Public methods
decode
public static Bitmap decode(
byte[] data,
int length,
@Nullable BitmapFactory.Options options,
int maximumOutputDimension
)
Decodes a Bitmap from a byte array using BitmapFactory and the ExifInterface.
| Parameters | |
|---|---|
byte[] data |
Byte array of compressed image data. |
int length |
The number of bytes to parse. |
@Nullable BitmapFactory.Options options |
The |
int maximumOutputDimension |
The largest output Bitmap dimension that can be returned by this method, or |
| Throws | |
|---|---|
androidx.media3.common.ParserException |
if the |
java.io.IOException |
makeShared
public static Bitmap makeShared(Bitmap bitmap)
Returns a immutable, sharable version of Bitmap. If the same instance of a shared bitmap is send over binder calls, no additional copy is needed.
This method is a no-op if for API levels below 31 or if the Bitmap is already shared.