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, Data data, long rowBytes)
| 148 | * @return Image |
| 149 | */ |
| 150 | public static Image makeRasterFromData(ImageInfo imageInfo, Data data, long rowBytes) { |
| 151 | try { |
| 152 | Stats.onNativeCall(); |
| 153 | long ptr = _nMakeRasterFromData(imageInfo._width, |
| 154 | imageInfo._height, |
| 155 | imageInfo._colorInfo._colorType.ordinal(), |
| 156 | imageInfo._colorInfo._alphaType.ordinal(), |
| 157 | Native.getPtr(imageInfo._colorInfo._colorSpace), |
| 158 | Native.getPtr(data), |
| 159 | rowBytes); |
| 160 | if (ptr == 0) |
| 161 | throw new RuntimeException("Failed to makeRaster " + imageInfo + " " + data + " " + rowBytes); |
| 162 | return new Image(ptr); |
| 163 | } finally { |
| 164 | ReferenceUtil.reachabilityFence(imageInfo._colorInfo._colorSpace); |
| 165 | ReferenceUtil.reachabilityFence(data); |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | /** |
| 170 | * @deprecated - use {@link #makeRasterFromBitmap(Bitmap)} |
no test coverage detected