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)
| 36 | * @see <a href="https://fiddle.skia.org/c/@Image_MakeRasterCopy">https://fiddle.skia.org/c/@Image_MakeRasterCopy</a> |
| 37 | */ |
| 38 | public static Image makeRaster(ImageInfo imageInfo, byte[] bytes, long rowBytes) { |
| 39 | try { |
| 40 | Stats.onNativeCall(); |
| 41 | long ptr = _nMakeRaster(imageInfo._width, |
| 42 | imageInfo._height, |
| 43 | imageInfo._colorInfo._colorType.ordinal(), |
| 44 | imageInfo._colorInfo._alphaType.ordinal(), |
| 45 | Native.getPtr(imageInfo._colorInfo._colorSpace), |
| 46 | bytes, |
| 47 | rowBytes); |
| 48 | if (ptr == 0) |
| 49 | throw new RuntimeException("Failed to makeRaster " + imageInfo + " " + bytes + " " + rowBytes); |
| 50 | return new Image(ptr); |
| 51 | } finally { |
| 52 | Reference.reachabilityFence(imageInfo._colorInfo._colorSpace); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * <p>Creates Image from pixels.</p> |
no test coverage detected