-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
None
`BufImgSurfaceData.createData` can recognize not only built-in image types, but also some `TYPE_CUSTOM` configurations and init native raster data for them (by calling `initRaster`).
However, it misses some common layouts, which could easily be supported, for instance, 4-byte RGBA image:
```
ColorSpace srgb = ColorSpace.getInstance(ColorSpace.CS_sRGB);
ColorModel colorModel = new ComponentColorModel(srgb, true, true, TRANSLUCENT, TYPE_BYTE);
WritableRaster raster = Raster.createInterleavedRaster(TYPE_BYTE, 10, 10, 40, 4, new int[] {0, 1, 2, 3}, null);
BufferedImage image = new BufferedImage(colorModel, raster, true, null);
SurfaceData sd = SurfaceManager.getManager(image).getPrimarySurfaceData();
long nativeOps = sd.getNativeOps(); // This is NULL!
```
With unrecognized `TYPE_CUSTOM` images, native raster data is left uninitialized, which means that the image data cannot be accessed/manipulated from the native code, which is a pity, as those images could otherwise be used in accelerated blit loops, but now they have to be converted to a known format first. I suggest expanding logic in `BufImgSurfaceData.createData` to support multi-band pixel interleaved rasters with `TYPE_CUSTOM` images.
However, it misses some common layouts, which could easily be supported, for instance, 4-byte RGBA image:
```
ColorSpace srgb = ColorSpace.getInstance(ColorSpace.CS_sRGB);
ColorModel colorModel = new ComponentColorModel(srgb, true, true, TRANSLUCENT, TYPE_BYTE);
WritableRaster raster = Raster.createInterleavedRaster(TYPE_BYTE, 10, 10, 40, 4, new int[] {0, 1, 2, 3}, null);
BufferedImage image = new BufferedImage(colorModel, raster, true, null);
SurfaceData sd = SurfaceManager.getManager(image).getPrimarySurfaceData();
long nativeOps = sd.getNativeOps(); // This is NULL!
```
With unrecognized `TYPE_CUSTOM` images, native raster data is left uninitialized, which means that the image data cannot be accessed/manipulated from the native code, which is a pity, as those images could otherwise be used in accelerated blit loops, but now they have to be converted to a known format first. I suggest expanding logic in `BufImgSurfaceData.createData` to support multi-band pixel interleaved rasters with `TYPE_CUSTOM` images.