public static Bitmap
drawable2Bitmap(Drawable d
) {
Bitmap bm
= Bitmap
.createBitmap(d
.getIntrinsicWidth(),
d
.getIntrinsicHeight(), d
.getOpacity() != PixelFormat
.OPAQUE
? Bitmap
.Config
.ARGB_8888
: Bitmap
.Config
.RGB_565
);
Canvas cv
= new Canvas(bm
);
d
.setBounds(0, 0, d
.getIntrinsicWidth(), d
.getIntrinsicHeight());
d
.draw(cv
);
return bm
;
}
public static Drawable
drawable2Bitmap(Bitmap b
) {
return new BitmapDrawable(b
);
}
转载请注明原文地址: https://mac.8miu.com/read-494092.html