Package icyllis.arc3d.core

# Class PixelUtils

java.lang.Object
icyllis.arc3d.core.PixelUtils

public class PixelUtils extends Object
Utilities to access and convert pixels, heap and native.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static interface`
  `PixelUtils.PixelLoad`
  Load pixel value in low precision.
  `static interface`
  `PixelUtils.PixelOp`
  Load or store pixel value in high precision.
  `static interface`
  `PixelUtils.PixelStore`
  Store pixel value in low precision.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `kColorSpaceXformFlagEncode`
  `static final int`
  `kColorSpaceXformFlagGamutTransform`
  `static final int`
  `kColorSpaceXformFlagLinearize`
  `static final int`
  `kColorSpaceXformFlagPremul`
  `static final int`
  `kColorSpaceXformFlagUnpremul`
  `static final boolean`
  `NATIVE_BIG_ENDIAN`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PixelUtils()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static boolean`
  `convertPixels(ImageInfo srcInfo, Object srcBase, long srcAddr, long srcRowBytes, ImageInfo dstInfo, Object dstBase, long dstAddr, long dstRowBytes)`
  Performs color type, alpha type, and color space conversion.
  `static boolean`
  `convertPixels(ImageInfo srcInfo, Object srcBase, long srcAddr, long srcRowBytes, ImageInfo dstInfo, Object dstBase, long dstAddr, long dstRowBytes, boolean flipY)`
  Performs color type, alpha type, color space, and origin conversion.
  `static boolean`
  `convertPixels(Pixmap src, Pixmap dst)`
  Performs color type, alpha type, and color space conversion.
  `static boolean`
  `convertPixels(Pixmap src, Pixmap dst, boolean flipY)`
  Performs color type, alpha type, color space, and origin conversion.
  `static void`
  `copyImage(long srcAddr, long srcRowBytes, long dstAddr, long dstRowBytes, long trimRowBytes, int rowCount)`
  Copy memory row by row.
  `static void`
  `copyImage(long srcAddr, long srcRowBytes, long dstAddr, long dstRowBytes, long trimRowBytes, int rowCount, boolean flipY)`
  Copy memory row by row, allowing vertical flip.
  `static void`
  `copyImage(Object srcBase, long srcAddr, long srcRowBytes, Object dstBase, long dstAddr, long dstRowBytes, long trimRowBytes, int rowCount)`
  Copy memory row by row, allowing heap to off-heap copy.
  `static void`
  `copyImage(Object srcBase, long srcAddr, long srcRowBytes, Object dstBase, long dstAddr, long dstRowBytes, long trimRowBytes, int rowCount, boolean flipY)`
  Copy memory row by row, allowing heap to off-heap copy and vertical flip.
  `static PixelUtils.PixelLoad`
  `load(int ct)`
  Load a pixel value in low precision.
  `static int`
  `load_ABGR_8888(Object base, long addr)`
  `static void`
  `load_ABGR_8888(Object base, long addr, float[] dst)`
  `static int`
  `load_ALPHA_16(Object base, long addr)`
  `static void`
  `load_ALPHA_16(Object base, long addr, float[] dst)`
  `static int`
  `load_ALPHA_8(Object base, long addr)`
  `static void`
  `load_ALPHA_8(Object base, long addr, float[] dst)`
  `static int`
  `load_ALPHA_F16(Object base, long addr)`
  `static void`
  `load_ALPHA_F16(Object base, long addr, float[] dst)`
  `static int`
  `load_ARGB_8888(Object base, long addr)`
  `static void`
  `load_ARGB_8888(Object base, long addr, float[] dst)`
  `static int`
  `load_BGR_565(Object base, long addr)`
  `static void`
  `load_BGR_565(Object base, long addr, float[] dst)`
  `static int`
  `load_BGRA_1010102(Object base, long addr)`
  `static void`
  `load_BGRA_1010102(Object base, long addr, float[] dst)`
  `static int`
  `load_BGRA_8888(Object base, long addr)`
  `static void`
  `load_BGRA_8888(Object base, long addr, float[] dst)`
  `static int`
  `load_GRAY_8(Object base, long addr)`
  `static void`
  `load_GRAY_8(Object base, long addr, float[] dst)`
  `static int`
  `load_GRAY_ALPHA_88(Object base, long addr)`
  `static void`
  `load_GRAY_ALPHA_88(Object base, long addr, float[] dst)`
  `static int`
  `load_R_16(Object base, long addr)`
  `static void`
  `load_R_16(Object base, long addr, float[] dst)`
  `static int`
  `load_R_8(Object base, long addr)`
  `static void`
  `load_R_8(Object base, long addr, float[] dst)`
  `static int`
  `load_R_F16(Object base, long addr)`
  `static void`
  `load_R_F16(Object base, long addr, float[] dst)`
  `static int`
  `load_RG_1616(Object base, long addr)`
  `static void`
  `load_RG_1616(Object base, long addr, float[] dst)`
  `static int`
  `load_RG_88(Object base, long addr)`
  `static void`
  `load_RG_88(Object base, long addr, float[] dst)`
  `static int`
  `load_RG_F16(Object base, long addr)`
  `static void`
  `load_RG_F16(Object base, long addr, float[] dst)`
  `static int`
  `load_RGB_888(Object base, long addr)`
  `static void`
  `load_RGB_888(Object base, long addr, float[] dst)`
  `static int`
  `load_RGBA_1010102(Object base, long addr)`
  `static void`
  `load_RGBA_1010102(Object base, long addr, float[] dst)`
  `static int`
  `load_RGBA_16161616(Object base, long addr)`
  `static void`
  `load_RGBA_16161616(Object base, long addr, float[] dst)`
  `static int`
  `load_RGBA_8888(Object base, long addr)`
  `static void`
  `load_RGBA_8888(Object base, long addr, float[] dst)`
  `static int`
  `load_RGBA_F16(Object base, long addr)`
  `static void`
  `load_RGBA_F16(Object base, long addr, float[] dst)`
  `static int`
  `load_RGBA_F32(Object base, long addr)`
  `static void`
  `load_RGBA_F32(Object base, long addr, float[] dst)`
  `static int`
  `load_RGBX_8888(Object base, long addr)`
  `static void`
  `load_RGBX_8888(Object base, long addr, float[] dst)`
  `static PixelUtils.PixelOp`
  `loadOp(int ct)`
  Load a pixel value in high precision.
  `static void`
  `packA8ToBW(Object srcBase, long srcAddr, int srcRowBytes, Object dstBase, long dstAddr, int dstRowBytes, int width, int height)`
  Pack Alpha8 format to B/W format.
  `static void`
  `setPixel16(Object base, long addr, short value, int count)`
  `static void`
  `setPixel32(Object base, long addr, int value, int count)`
  `static void`
  `setPixel64(Object base, long addr, long value, int count)`
  `static PixelUtils.PixelStore`
  `store(int ct)`
  Store a pixel value in low precision.
  `static void`
  `store_ABGR_8888(Object base, long addr, float[] src)`
  `static void`
  `store_ABGR_8888(Object base, long addr, int src)`
  `static void`
  `store_ALPHA_16(Object base, long addr, float[] src)`
  `static void`
  `store_ALPHA_8(Object base, long addr, float[] src)`
  `static void`
  `store_ALPHA_8(Object base, long addr, int src)`
  `static void`
  `store_ALPHA_F16(Object base, long addr, float[] src)`
  `static void`
  `store_ARGB_8888(Object base, long addr, float[] src)`
  `static void`
  `store_ARGB_8888(Object base, long addr, int src)`
  `static void`
  `store_BGR_565(Object base, long addr, float[] src)`
  `static void`
  `store_BGR_565(Object base, long addr, int src)`
  `static void`
  `store_BGRA_1010102(Object base, long addr, float[] src)`
  `static void`
  `store_BGRA_8888(Object base, long addr, float[] src)`
  `static void`
  `store_BGRA_8888(Object base, long addr, int src)`
  `static void`
  `store_GRAY_8(Object base, long addr, float[] src)`
  `static void`
  `store_GRAY_8(Object base, long addr, int src)`
  `static void`
  `store_GRAY_ALPHA_88(Object base, long addr, float[] src)`
  `static void`
  `store_GRAY_ALPHA_88(Object base, long addr, int src)`
  `static void`
  `store_R_16(Object base, long addr, float[] src)`
  `static void`
  `store_R_8(Object base, long addr, float[] src)`
  `static void`
  `store_R_8(Object base, long addr, int src)`
  `static void`
  `store_R_F16(Object base, long addr, float[] src)`
  `static void`
  `store_RG_1616(Object base, long addr, float[] src)`
  `static void`
  `store_RG_88(Object base, long addr, float[] src)`
  `static void`
  `store_RG_88(Object base, long addr, int src)`
  `static void`
  `store_RG_F16(Object base, long addr, float[] src)`
  `static void`
  `store_RGB_888(Object base, long addr, float[] src)`
  `static void`
  `store_RGB_888(Object base, long addr, int src)`
  `static void`
  `store_RGBA_1010102(Object base, long addr, float[] src)`
  `static void`
  `store_RGBA_16161616(Object base, long addr, float[] src)`
  `static void`
  `store_RGBA_8888(Object base, long addr, float[] src)`
  `static void`
  `store_RGBA_8888(Object base, long addr, int src)`
  `static void`
  `store_RGBA_F16(Object base, long addr, float[] src)`
  `static void`
  `store_RGBA_F32(Object base, long addr, float[] src)`
  `static void`
  `store_RGBX_8888(Object base, long addr, float[] src)`
  `static void`
  `store_RGBX_8888(Object base, long addr, int src)`
  `static PixelUtils.PixelOp`
  `storeOp(int ct)`
  Store a pixel value in high precision.
  `static void`
  `unpackBWToA8(Object srcBase, long srcAddr, int srcRowBytes, Object dstBase, long dstAddr, int dstRowBytes, int width, int height)`
  Unpack B/W format to Alpha8 format.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### NATIVE_BIG_ENDIAN

    public static final boolean NATIVE_BIG_ENDIAN

  - ### kColorSpaceXformFlagUnpremul

    public static final int kColorSpaceXformFlagUnpremul
    See Also:
      - Constant Field Values

  - ### kColorSpaceXformFlagLinearize

    public static final int kColorSpaceXformFlagLinearize
    See Also:
      - Constant Field Values

  - ### kColorSpaceXformFlagGamutTransform

    public static final int kColorSpaceXformFlagGamutTransform
    See Also:
      - Constant Field Values

  - ### kColorSpaceXformFlagEncode

    public static final int kColorSpaceXformFlagEncode
    See Also:
      - Constant Field Values

  - ### kColorSpaceXformFlagPremul

    public static final int kColorSpaceXformFlagPremul
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### PixelUtils

    public PixelUtils()

- ## Method Details

  - ### copyImage

    public static void copyImage(long srcAddr, long srcRowBytes, long dstAddr, long dstRowBytes, long trimRowBytes, int rowCount)
    Copy memory row by row.

  - ### copyImage

    public static void copyImage(long srcAddr, long srcRowBytes, long dstAddr, long dstRowBytes, long trimRowBytes, int rowCount, boolean flipY)
    Copy memory row by row, allowing vertical flip.

  - ### copyImage

    public static void copyImage(Object srcBase, long srcAddr, long srcRowBytes, Object dstBase, long dstAddr, long dstRowBytes, long trimRowBytes, int rowCount)
    Copy memory row by row, allowing heap to off-heap copy.

  - ### copyImage

    public static void copyImage(Object srcBase, long srcAddr, long srcRowBytes, Object dstBase, long dstAddr, long dstRowBytes, long trimRowBytes, int rowCount, boolean flipY)
    Copy memory row by row, allowing heap to off-heap copy and vertical flip.

  - ### packA8ToBW

    public static void packA8ToBW(Object srcBase, long srcAddr, int srcRowBytes, Object dstBase, long dstAddr, int dstRowBytes, int width, int height)
    Pack Alpha8 format to B/W format.

  - ### unpackBWToA8

    public static void unpackBWToA8(Object srcBase, long srcAddr, int srcRowBytes, Object dstBase, long dstAddr, int dstRowBytes, int width, int height)
    Unpack B/W format to Alpha8 format.

  - ### setPixel16

    public static void setPixel16(Object base, long addr, short value, int count)

  - ### setPixel32

    public static void setPixel32(Object base, long addr, int value, int count)

  - ### setPixel64

    public static void setPixel64(Object base, long addr, long value, int count)

  - ### load_BGR_565

    public static int load_BGR_565(Object base, long addr)

  - ### load_RGBA_1010102

    public static int load_RGBA_1010102(Object base, long addr)

  - ### load_BGRA_1010102

    public static int load_BGRA_1010102(Object base, long addr)

  - ### load_R_8

    public static int load_R_8(Object base, long addr)

  - ### load_RG_88

    public static int load_RG_88(Object base, long addr)

  - ### load_RGB_888

    public static int load_RGB_888(Object base, long addr)

  - ### load_RGBX_8888

    public static int load_RGBX_8888(Object base, long addr)

  - ### load_RGBA_8888

    public static int load_RGBA_8888(Object base, long addr)

  - ### load_BGRA_8888

    public static int load_BGRA_8888(Object base, long addr)

  - ### load_ABGR_8888

    public static int load_ABGR_8888(Object base, long addr)

  - ### load_ARGB_8888

    public static int load_ARGB_8888(Object base, long addr)

  - ### load_GRAY_8

    public static int load_GRAY_8(Object base, long addr)

  - ### load_GRAY_ALPHA_88

    public static int load_GRAY_ALPHA_88(Object base, long addr)

  - ### load_ALPHA_8

    public static int load_ALPHA_8(Object base, long addr)

  - ### load_R_16

    public static int load_R_16(Object base, long addr)

  - ### load_RG_1616

    public static int load_RG_1616(Object base, long addr)

  - ### load_RGBA_16161616

    public static int load_RGBA_16161616(Object base, long addr)

  - ### load_ALPHA_16

    public static int load_ALPHA_16(Object base, long addr)

  - ### load_R_F16

    public static int load_R_F16(Object base, long addr)

  - ### load_RG_F16

    public static int load_RG_F16(Object base, long addr)

  - ### load_RGBA_F16

    public static int load_RGBA_F16(Object base, long addr)

  - ### load_ALPHA_F16

    public static int load_ALPHA_F16(Object base, long addr)

  - ### load_RGBA_F32

    public static int load_RGBA_F32(Object base, long addr)

  - ### load

    @Nonnull @Contract(pure=true) public static PixelUtils.PixelLoad load(int ct)
    Load a pixel value in low precision.

  - ### store_BGR_565

    public static void store_BGR_565(Object base, long addr, int src)

  - ### store_R_8

    public static void store_R_8(Object base, long addr, int src)

  - ### store_RG_88

    public static void store_RG_88(Object base, long addr, int src)

  - ### store_RGB_888

    public static void store_RGB_888(Object base, long addr, int src)

  - ### store_RGBX_8888

    public static void store_RGBX_8888(Object base, long addr, int src)

  - ### store_RGBA_8888

    public static void store_RGBA_8888(Object base, long addr, int src)

  - ### store_BGRA_8888

    public static void store_BGRA_8888(Object base, long addr, int src)

  - ### store_ABGR_8888

    public static void store_ABGR_8888(Object base, long addr, int src)

  - ### store_ARGB_8888

    public static void store_ARGB_8888(Object base, long addr, int src)

  - ### store_GRAY_8

    public static void store_GRAY_8(Object base, long addr, int src)

  - ### store_GRAY_ALPHA_88

    public static void store_GRAY_ALPHA_88(Object base, long addr, int src)

  - ### store_ALPHA_8

    public static void store_ALPHA_8(Object base, long addr, int src)

  - ### store

    @Nonnull @Contract(pure=true) public static PixelUtils.PixelStore store(int ct)
    Store a pixel value in low precision.

  - ### load_BGR_565

    public static void load_BGR_565(Object base, long addr, float[] dst)

  - ### load_RGBA_1010102

    public static void load_RGBA_1010102(Object base, long addr, float[] dst)

  - ### load_BGRA_1010102

    public static void load_BGRA_1010102(Object base, long addr, float[] dst)

  - ### load_R_8

    public static void load_R_8(Object base, long addr, float[] dst)

  - ### load_RG_88

    public static void load_RG_88(Object base, long addr, float[] dst)

  - ### load_RGB_888

    public static void load_RGB_888(Object base, long addr, float[] dst)

  - ### load_RGBX_8888

    public static void load_RGBX_8888(Object base, long addr, float[] dst)

  - ### load_RGBA_8888

    public static void load_RGBA_8888(Object base, long addr, float[] dst)

  - ### load_BGRA_8888

    public static void load_BGRA_8888(Object base, long addr, float[] dst)

  - ### load_ABGR_8888

    public static void load_ABGR_8888(Object base, long addr, float[] dst)

  - ### load_ARGB_8888

    public static void load_ARGB_8888(Object base, long addr, float[] dst)

  - ### load_GRAY_8

    public static void load_GRAY_8(Object base, long addr, float[] dst)

  - ### load_GRAY_ALPHA_88

    public static void load_GRAY_ALPHA_88(Object base, long addr, float[] dst)

  - ### load_ALPHA_8

    public static void load_ALPHA_8(Object base, long addr, float[] dst)

  - ### load_R_16

    public static void load_R_16(Object base, long addr, float[] dst)

  - ### load_RG_1616

    public static void load_RG_1616(Object base, long addr, float[] dst)

  - ### load_RGBA_16161616

    public static void load_RGBA_16161616(Object base, long addr, float[] dst)

  - ### load_ALPHA_16

    public static void load_ALPHA_16(Object base, long addr, float[] dst)

  - ### load_R_F16

    public static void load_R_F16(Object base, long addr, float[] dst)

  - ### load_RG_F16

    public static void load_RG_F16(Object base, long addr, float[] dst)

  - ### load_RGBA_F16

    public static void load_RGBA_F16(Object base, long addr, float[] dst)

  - ### load_ALPHA_F16

    public static void load_ALPHA_F16(Object base, long addr, float[] dst)

  - ### load_RGBA_F32

    public static void load_RGBA_F32(Object base, long addr, float[] dst)

  - ### loadOp

    @Nonnull @Contract(pure=true) public static PixelUtils.PixelOp loadOp(int ct)
    Load a pixel value in high precision.

  - ### store_BGR_565

    public static void store_BGR_565(Object base, long addr, float[] src)

  - ### store_RGBA_1010102

    public static void store_RGBA_1010102(Object base, long addr, float[] src)

  - ### store_BGRA_1010102

    public static void store_BGRA_1010102(Object base, long addr, float[] src)

  - ### store_R_8

    public static void store_R_8(Object base, long addr, float[] src)

  - ### store_RG_88

    public static void store_RG_88(Object base, long addr, float[] src)

  - ### store_RGB_888

    public static void store_RGB_888(Object base, long addr, float[] src)

  - ### store_RGBX_8888

    public static void store_RGBX_8888(Object base, long addr, float[] src)

  - ### store_RGBA_8888

    public static void store_RGBA_8888(Object base, long addr, float[] src)

  - ### store_BGRA_8888

    public static void store_BGRA_8888(Object base, long addr, float[] src)

  - ### store_ABGR_8888

    public static void store_ABGR_8888(Object base, long addr, float[] src)

  - ### store_ARGB_8888

    public static void store_ARGB_8888(Object base, long addr, float[] src)

  - ### store_GRAY_8

    public static void store_GRAY_8(Object base, long addr, float[] src)

  - ### store_GRAY_ALPHA_88

    public static void store_GRAY_ALPHA_88(Object base, long addr, float[] src)

  - ### store_ALPHA_8

    public static void store_ALPHA_8(Object base, long addr, float[] src)

  - ### store_R_16

    public static void store_R_16(Object base, long addr, float[] src)

  - ### store_RG_1616

    public static void store_RG_1616(Object base, long addr, float[] src)

  - ### store_RGBA_16161616

    public static void store_RGBA_16161616(Object base, long addr, float[] src)

  - ### store_ALPHA_16

    public static void store_ALPHA_16(Object base, long addr, float[] src)

  - ### store_R_F16

    public static void store_R_F16(Object base, long addr, float[] src)

  - ### store_RG_F16

    public static void store_RG_F16(Object base, long addr, float[] src)

  - ### store_RGBA_F16

    public static void store_RGBA_F16(Object base, long addr, float[] src)

  - ### store_ALPHA_F16

    public static void store_ALPHA_F16(Object base, long addr, float[] src)

  - ### store_RGBA_F32

    public static void store_RGBA_F32(Object base, long addr, float[] src)

  - ### storeOp

    @Nonnull @Contract(pure=true) public static PixelUtils.PixelOp storeOp(int ct)
    Store a pixel value in high precision.

  - ### convertPixels

    public static boolean convertPixels(@Nonnull Pixmap src, @Nonnull Pixmap dst)
    Performs color type, alpha type, and color space conversion. Addresses (offsets) must be aligned to bytes-per-pixel, scaling is not allowed.

  - ### convertPixels

    public static boolean convertPixels(@Nonnull Pixmap src, @Nonnull Pixmap dst, boolean flipY)
    Performs color type, alpha type, color space, and origin conversion. Addresses (offsets) must be aligned to bytes-per-pixel (except for non-power-of-two), scaling is not allowed.

  - ### convertPixels

    public static boolean convertPixels(@Nonnull ImageInfo srcInfo, Object srcBase, long srcAddr, long srcRowBytes, @Nonnull ImageInfo dstInfo, Object dstBase, long dstAddr, long dstRowBytes)
    Performs color type, alpha type, and color space conversion. Addresses (offsets) must be aligned to bytes-per-pixel, scaling is not allowed.

  - ### convertPixels

    public static boolean convertPixels(@Nonnull ImageInfo srcInfo, Object srcBase, long srcAddr, long srcRowBytes, @Nonnull ImageInfo dstInfo, Object dstBase, long dstAddr, long dstRowBytes, boolean flipY)
    Performs color type, alpha type, color space, and origin conversion. Addresses (offsets) must be aligned to bytes-per-pixel (except for non-power-of-two), scaling is not allowed.