Class Palette

java.lang.Object
bdsup2sub.bitmap.Palette

public class Palette extends Object
Palette class for mixed representation of RGB/YCbCr palettes with alpha information.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final byte[]
    Byte buffer for alpha info
    private final byte[]
    Byte buffer for BLUE info
    private final byte[]
    Byte buffer for Cb (chrominance blue) info
    private final byte[]
    Byte buffer for Cr (chrominance red) info
    private final byte[]
    Byte buffer for GREEN info
    private final byte[]
    Byte buffer for RED info
    private final int
    Number of palette entries
    private final boolean
    Use BT.601 color model instead of BT.709
    private final byte[]
    Byte buffer for Y (luminance) info
  • Constructor Summary

    Constructors
    Constructor
    Description
    Palette(byte[] red, byte[] green, byte[] blue, byte[] alpha)
    Constructs a palette from red, green blue and alpha buffers using BT.709
    Palette(byte[] red, byte[] green, byte[] blue, byte[] alpha, boolean useBT601)
     
    Palette(int size)
    Initializes a palette with transparent black (RGBA: 0x00000000)
    Palette(int size, boolean useBT601)
    Initializes palette with transparent black (RGBA: 0x00000000)
    Palette(Palette palette)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
     
    int
    getAlpha(int index)
     
    int
    getARGB(int index)
     
    byte[]
     
    byte[]
     
    getColor(int index)
     
     
    byte[]
     
    byte[]
     
    int
     
    byte[]
     
    int[]
    getRGB(int index)
     
    int
     
    byte[]
     
    int[]
    getYCbCr(int index)
     
    void
    setAlpha(int index, int alpha)
     
    void
    setARGB(int index, int c)
     
    void
    setColor(int index, Color c)
     
    void
    setRGB(int index, int red, int green, int blue)
     
    void
    setYCbCr(int index, int yn, int cbn, int crn)
     
    boolean
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • size

      private final int size
      Number of palette entries
    • r

      private final byte[] r
      Byte buffer for RED info
    • g

      private final byte[] g
      Byte buffer for GREEN info
    • b

      private final byte[] b
      Byte buffer for BLUE info
    • a

      private final byte[] a
      Byte buffer for alpha info
    • y

      private final byte[] y
      Byte buffer for Y (luminance) info
    • cb

      private final byte[] cb
      Byte buffer for Cb (chrominance blue) info
    • cr

      private final byte[] cr
      Byte buffer for Cr (chrominance red) info
    • useBT601

      private final boolean useBT601
      Use BT.601 color model instead of BT.709
  • Constructor Details

    • Palette

      public Palette(int size, boolean useBT601)
      Initializes palette with transparent black (RGBA: 0x00000000)
      Parameters:
      size - Number of palette entries
    • Palette

      public Palette(int size)
      Initializes a palette with transparent black (RGBA: 0x00000000)
    • Palette

      public Palette(byte[] red, byte[] green, byte[] blue, byte[] alpha, boolean useBT601)
    • Palette

      public Palette(byte[] red, byte[] green, byte[] blue, byte[] alpha)
      Constructs a palette from red, green blue and alpha buffers using BT.709
    • Palette

      public Palette(Palette palette)
  • Method Details

    • getColorModel

      public ColorModel getColorModel()
    • setColor

      public void setColor(int index, Color c)
    • setARGB

      public void setARGB(int index, int c)
    • getColor

      public Color getColor(int index)
    • getARGB

      public int getARGB(int index)
    • setRGB

      public void setRGB(int index, int red, int green, int blue)
    • setYCbCr

      public void setYCbCr(int index, int yn, int cbn, int crn)
    • setAlpha

      public void setAlpha(int index, int alpha)
    • getAlpha

      public int getAlpha(int index)
    • getAlpha

      public byte[] getAlpha()
    • getRGB

      public int[] getRGB(int index)
    • getYCbCr

      public int[] getYCbCr(int index)
    • getR

      public byte[] getR()
    • getG

      public byte[] getG()
    • getB

      public byte[] getB()
    • getY

      public byte[] getY()
    • getCb

      public byte[] getCb()
    • getCr

      public byte[] getCr()
    • getSize

      public int getSize()
    • getIndexOfMostTransparentPaletteEntry

      public int getIndexOfMostTransparentPaletteEntry()
    • usesBT601

      public boolean usesBT601()