Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8353542

Support native raster data for additional custom pixel-interleaved BufferedImage formats

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • client-libs
    • None
    • 2d

      `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.

            ngubarkov Nikita Gubarkov
            ngubarkov Nikita Gubarkov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: