MCPcopy Index your code
hub / github.com/HumbleUI/Skija / makeFromImage

Method makeFromImage

shared/java/Bitmap.java:52–63  ·  view source on GitHub ↗
(@NotNull Image image)

Source from the content-addressed store, hash-verified

50 }
51
52 @NotNull @Contract("-> new")
53 public static Bitmap makeFromImage(@NotNull Image image) {
54 assert image != null : "Can’t makeFromImage with image == null";
55 Bitmap bitmap = new Bitmap();
56 bitmap.allocPixels(image.getImageInfo());
57 if (image.readPixels(bitmap))
58 return bitmap;
59 else {
60 bitmap.close();
61 throw new RuntimeException("Failed to readPixels from " + image);
62 }
63 }
64
65 /**
66 * Swaps the fields of the two bitmaps.

Callers 1

drawMethod · 0.95

Calls 4

allocPixelsMethod · 0.95
getImageInfoMethod · 0.65
readPixelsMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected