Revert "Fix getting of bitmap"
This commit is contained in:
parent
be98177d83
commit
40b743aeb0
1 changed files with 3 additions and 7 deletions
|
@ -190,16 +190,12 @@ public class SampleUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] getDrawableAsByteArray(Drawable drawable) {
|
public static byte[] getDrawableAsByteArray(Drawable drawable) {
|
||||||
Bitmap bitmap;
|
|
||||||
if (drawable instanceof BitmapDrawable) {
|
if (drawable instanceof BitmapDrawable) {
|
||||||
bitmap = ((BitmapDrawable) drawable).getBitmap();
|
Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
|
||||||
} else if (drawable.getIntrinsicWidth() <= 0 || drawable.getIntrinsicHeight() <= 0) {
|
|
||||||
bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
|
|
||||||
} else {
|
|
||||||
bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
|
|
||||||
}
|
|
||||||
return getBitmapAsByteArray(bitmap);
|
return getBitmapAsByteArray(bitmap);
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static byte[] getBitmapAsByteArray(Bitmap bitmap) {
|
public static byte[] getBitmapAsByteArray(Bitmap bitmap) {
|
||||||
int size = bitmap.getRowBytes() * bitmap.getHeight();
|
int size = bitmap.getRowBytes() * bitmap.getHeight();
|
||||||
|
|
Loading…
Reference in a new issue