public class BitmapUtils
extends java.lang.Object
Constructor | Description |
---|---|
BitmapUtils() |
Modifier and Type | Method | Description |
---|---|---|
static android.graphics.Bitmap |
createBitmapFromView(android.view.View view) |
Convert a view to a bitmap.
|
static boolean |
equals(android.graphics.Bitmap bitmap,
android.graphics.Bitmap other) |
Validates if the bytes of a bitmap matches another
|
static android.graphics.Bitmap |
getBitmapFromDrawable(android.graphics.drawable.Drawable sourceDrawable) |
Extract an underlying bitmap from a drawable
|
static byte[] |
getByteArrayFromDrawable(android.graphics.drawable.Drawable drawable) |
Create a byte array out of drawable
|
static android.graphics.drawable.Drawable |
getDrawableFromByteArray(android.content.Context context,
byte[] array) |
Decode byte array to drawable object
|
static android.graphics.drawable.Drawable |
getDrawableFromRes(android.content.Context context,
int drawableRes) |
Get a drawable from a resource.
|
static android.graphics.drawable.Drawable |
getDrawableFromRes(android.content.Context context,
int drawableRes,
java.lang.Integer tintColor) |
Get a tinted drawable from a resource.
|
static android.graphics.Bitmap |
mergeBitmap(android.graphics.Bitmap background,
android.graphics.Bitmap foreground) |
Create a bitmap from a background and a foreground bitmap
|
static android.graphics.Bitmap |
mergeBitmap(android.graphics.Bitmap background,
android.graphics.Bitmap foreground,
float left,
float top) |
Create a bitmap from a background and a foreground bitmap
|
public static android.graphics.Bitmap createBitmapFromView(@NonNull android.view.View view)
view
- the view to convertpublic static android.graphics.Bitmap mergeBitmap(@NonNull android.graphics.Bitmap background, @NonNull android.graphics.Bitmap foreground)
background
- The bitmap placed in the backgroundforeground
- The bitmap placed in the foregroundpublic static android.graphics.Bitmap mergeBitmap(@NonNull android.graphics.Bitmap background, @NonNull android.graphics.Bitmap foreground, float left, float top)
background
- The bitmap placed in the backgroundforeground
- The bitmap placed in the foregroundleft
- position of the left side of the foreground bitmaptop
- position of the top side of the foreground bitmap@Nullable public static android.graphics.Bitmap getBitmapFromDrawable(@Nullable android.graphics.drawable.Drawable sourceDrawable)
sourceDrawable
- The source drawable@Nullable public static byte[] getByteArrayFromDrawable(@Nullable android.graphics.drawable.Drawable drawable)
drawable
- The source drawable@Nullable public static android.graphics.drawable.Drawable getDrawableFromByteArray(@NonNull android.content.Context context, @Nullable byte[] array)
context
- Context to obtain Resources
array
- The source byte array@Nullable public static android.graphics.drawable.Drawable getDrawableFromRes(@NonNull android.content.Context context, @DrawableRes int drawableRes)
context
- Context to obtain Resources
drawableRes
- Drawable resource@Nullable public static android.graphics.drawable.Drawable getDrawableFromRes(@NonNull android.content.Context context, @DrawableRes int drawableRes, @Nullable java.lang.Integer tintColor)
context
- Context to obtain Resources
drawableRes
- Drawable resourcetintColor
- Tint colorpublic static boolean equals(android.graphics.Bitmap bitmap, android.graphics.Bitmap other)
bitmap
- the bitmap to be compared againstother
- the bitmap to compare with