MCPcopy Create free account
hub / github.com/JetBrains/skija / makeFromBitmap

Method makeFromBitmap

shared/java/Image.java:111–123  ·  view source on GitHub ↗

Creates Image from bitmap, sharing or copying bitmap pixels. If the bitmap is marked immutable, and its pixel memory is shareable, it may be shared instead of copied. Image is returned if bitmap is valid. Valid Bitmap parameters include: dimensions are greater than zero;

(@NotNull Bitmap bitmap)

Source from the content-addressed store, hash-verified

109 * @see <a href="https://fiddle.skia.org/c/@Image_MakeFromBitmap">https://fiddle.skia.org/c/@Image_MakeFromBitmap</a>
110 */
111 @NotNull @Contract("_ -> new")
112 public static Image makeFromBitmap(@NotNull Bitmap bitmap) {
113 try {
114 assert bitmap != null : "Can’t makeFromBitmap with bitmap == null";
115 Stats.onNativeCall();
116 long ptr = _nMakeFromBitmap(Native.getPtr(bitmap));
117 if (ptr == 0)
118 throw new RuntimeException("Failed to Image::makeFromBitmap " + bitmap);
119 return new Image(ptr);
120 } finally {
121 Reference.reachabilityFence(bitmap);
122 }
123 }
124
125 @NotNull @Contract("_ -> new")
126 public static Image makeFromPixmap(@NotNull Pixmap pixmap) {

Callers 9

drawGrayMethod · 0.95
drawBitmapCanvasMethod · 0.95
drawPixelsMethod · 0.95
drawSubsetMethod · 0.95
drawPixelRefMethod · 0.95
drawAlphaMethod · 0.95
drawMethod · 0.95
drawMethod · 0.95
skImageMethod · 0.95

Calls 3

onNativeCallMethod · 0.95
_nMakeFromBitmapMethod · 0.95
getPtrMethod · 0.95

Tested by

no test coverage detected