MCPcopy Create free account
hub / github.com/Tencent/libpag / FromBitmap

Method FromBitmap

android/libpag/src/main/java/org/libpag/PAGImage.java:20–29  ·  view source on GitHub ↗

Creates a PAGImage object from an android.graphics.Bitmap object, return null if it's not valid Bitmap.

(Bitmap bitmap)

Source from the content-addressed store, hash-verified

18 * valid Bitmap.
19 */
20 public static PAGImage FromBitmap(Bitmap bitmap) {
21 if (bitmap != null && bitmap.getConfig() == Bitmap.Config.ARGB_4444) {
22 bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, false);
23 }
24 long context = LoadFromBitmap(bitmap);
25 if (context == 0) {
26 return null;
27 }
28 return new PAGImage(context);
29 }
30
31 /**
32 * Creates a PAGImage object from a path of a image file, return null if the file does not exist

Callers 1

addPAGViewAndPlayMethod · 0.95

Calls 2

LoadFromBitmapMethod · 0.95
copyMethod · 0.80

Tested by

no test coverage detected