Interface PixelFormat.Composition

All Known Implementing Classes:
PixelFormat.PackedComposition
Enclosing class:
PixelFormat

public static interface PixelFormat.Composition
Pixel composition, i.e. layout of its components.
  • Field Details

  • Method Details

    • isUniform

      boolean isUniform()
      Returns true if all components are of same bit-size, e.g. RGBA8888, otherwise false, e.g. RGBA5551
    • isInterleaved

      boolean isInterleaved()
      Returns true if all components are packed, i.e. interleaved, e.g. RGBA8888, otherwise false.
    • componentCount

      int componentCount()
      Number of components per pixel, e.g. 3 for RGBx8888.
    • bitsPerPixel

      int bitsPerPixel()
      Number of bits per pixel, e.g. 24 bits for RGBx8888.
    • bitStride

      int bitStride()
      Bit distance between pixels.

      For packed pixels e.g. 32 bits for RGBx8888.

    • bytesPerPixel

      int bytesPerPixel()
      Number of bytes per pixel, i.e. packed bitStride() in bytes, e.g. 4 for RGBx8888.
    • componentOrder

      PixelFormat.CType[] componentOrder()
      Returns the Component type order of all components, see componentBitMask().
    • find

      int find(PixelFormat.CType s)
      Returns the index of given PixelFormat.CType within componentOrder(), -1 if not exists.
    • componentBitMask

      int[] componentBitMask()
      Returns the un-shifted bit-mask of all components.

      Components mask is returned in the order Low-Index to High-Index, e.g.:

      • RGB565: 0: R 0x1F, 1: G 0x3F, 2: B 0x1F
      • RGBA5551: 0: R 0x1F, 1: G 0x1F, 2: B 0x1F, 3: A 0x01
      • RGBA8888: 0: R 0xFF, 1: G 0xFF, 2: B 0xFF, 3: A 0xFF

    • componentBitCount

      int[] componentBitCount()
      Returns the number of bits of all components, see componentBitMask().
    • componentBitShift

      int[] componentBitShift()
      Returns the bit-shift of all components, see componentBitMask().
    • decodeSingleI32

      int decodeSingleI32(int shifted, int cIdx)
      Decodes a component from the shifted pixel data with a bytesPerPixel() of up to 32bit.
      Parameters:
      shifted - complete pixel encoded into on 32bit integer
      cIdx - the desired component index
      Returns:
      the decoded component value
    • decodeSingleI64

      int decodeSingleI64(long shifted, int cIdx)
      Decodes a component from the shifted pixel data with a bytesPerPixel() of up to 64bit.
      Parameters:
      shifted - complete pixel encoded into on 64bit integer
      cIdx - the desired component index
      Returns:
      the decoded component value
    • encodeSingleI32

      int encodeSingleI32(int norm, int cIdx)
    • encodeSingleI64

      long encodeSingleI64(int norm, int cIdx)
    • encode3CompI32

      int encode3CompI32(int c1NormI32, int c2NormI32, int c3NormI32)
    • encode4CompI32

      int encode4CompI32(int c1NormI32, int c2NormI32, int c3NormI32, int c4NormI32)
    • encodeSingleI8

      int encodeSingleI8(byte normalI8, int cIdx)
    • encode3CompI8

      int encode3CompI8(byte c1NormI8, byte c2NormI8, byte c3NormI8)
    • encode4CompI8

      int encode4CompI8(byte c1NormI8, byte c2NormI8, byte c3NormI8, byte c4NormI8)
    • toFloat

      float toFloat(int i32, int cIdx, boolean i32Shifted)
    • fromFloat

      int fromFloat(float f, int cIdx, boolean shiftResult)
    • defaultValue

      int defaultValue(int cIdx, boolean shiftResult)
    • hashCode

      int hashCode()
      Returns cached immutable hash value, see Object.hashCode().
      Overrides:
      hashCode in class Object
    • equals

      boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      String toString()
      Overrides:
      toString in class Object