Package org.apache.commons.imaging.palette

# Class QuantizedPalette

java.lang.Object
org.apache.commons.imaging.palette.QuantizedPalette

All Implemented Interfaces:
  `Palette`

public class QuantizedPalette extends Object implements Palette

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `QuantizedPalette(List<org.apache.commons.imaging.palette.ColorSpaceSubset> subsets, int precision)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getEntry(int index)`
  Gets the color for a given palette index.
  `int`
  `getPaletteIndex(int rgb)`
  Gets the palette index for a given color.
  `int`
  `length()`
  Gets the number of entries in the palette.

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

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

- ## Constructor Details

  - ### QuantizedPalette

    public QuantizedPalette(List<org.apache.commons.imaging.palette.ColorSpaceSubset> subsets, int precision)

- ## Method Details

  - ### getEntry

    public int getEntry(int index)
    Description copied from interface: `Palette`
    Gets the color for a given palette index.
    Specified by:
      `getEntry` in interface `Palette`
    Parameters:
      `index` - the palette index to look up
    Returns:
      the color in ARGB format

  - ### getPaletteIndex

    public int getPaletteIndex(int rgb) throws ImagingException
    Description copied from interface: `Palette`
    Gets the palette index for a given color.
    Specified by:
      `getPaletteIndex` in interface `Palette`
    Parameters:
      `rgb` - the color to look up
    Returns:
      the palette index
    Throws:
      `ImagingException` - if it fails to read the palette index

  - ### length

    public int length()
    Description copied from interface: `Palette`
    Gets the number of entries in the palette.
    Specified by:
      `length` in interface `Palette`
    Returns:
      the number of palette entries