MCPcopy Create free account
hub / github.com/HumbleUI/Skija / makeRasterFromBytes

Method makeRasterFromBytes

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

Creates Image from pixels. Image is returned if pixels are valid. Valid Pixmap parameters include: dimensions are greater than zero; each dimension fits in 29 bits; ColorType and AlphaType are valid, and ColorType is not ColorType.UNKNOWN; row bytes

(ImageInfo imageInfo, byte[] bytes, long rowBytes)

Source from the content-addressed store, hash-verified

105 * @see <a href="https://fiddle.skia.org/c/@Image_MakeRasterCopy">https://fiddle.skia.org/c/@Image_MakeRasterCopy</a>
106 */
107 public static Image makeRasterFromBytes(ImageInfo imageInfo, byte[] bytes, long rowBytes) {
108 try {
109 Stats.onNativeCall();
110 long ptr = _nMakeRasterFromBytes(imageInfo._width,
111 imageInfo._height,
112 imageInfo._colorInfo._colorType.ordinal(),
113 imageInfo._colorInfo._alphaType.ordinal(),
114 Native.getPtr(imageInfo._colorInfo._colorSpace),
115 bytes,
116 rowBytes);
117 if (ptr == 0)
118 throw new RuntimeException("Failed to makeRaster " + imageInfo + " " + bytes + " " + rowBytes);
119 return new Image(ptr);
120 } finally {
121 ReferenceUtil.reachabilityFence(imageInfo._colorInfo._colorSpace);
122 }
123 }
124
125 /**
126 * @deprecated - use {@link #makeRasterFromData(ImageInfo, Data, long)}

Callers 2

makeRasterMethod · 0.95
drawMethod · 0.95

Calls 4

onNativeCallMethod · 0.95
_nMakeRasterFromBytesMethod · 0.95
getPtrMethod · 0.95
reachabilityFenceMethod · 0.95

Tested by

no test coverage detected