Package org.gdal.gdal

Class ColorTable

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class ColorTable
    extends java.lang.Object
    implements java.lang.Cloneable
    Class ColorTable represents a color table / palette.

    The ColorTable class is a binding for the C++ GDALColorTable class.

    • Constructor Summary

      Constructors 
      Constructor Description
      ColorTable()
      Construct a new color table.
      ColorTable​(int ePaletteInterpretation)
      Construct a new color table.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      Make a copy of a color table.
      ColorTable Clone()
      Make a copy of a color table.
      void CreateColorRamp​(int nStartIndex, java.awt.Color startcolor, int nEndIndex, java.awt.Color endcolor)
      Create color ramp.
      void delete()  
      java.awt.Color GetColorEntry​(int entry)
      Fetch a color entry from table.
      int GetCount()
      Get number of color entries in table.
      java.awt.image.IndexColorModel getIndexColorModel​(int bits)  
      int GetPaletteInterpretation()
      Fetch palette interpretation.
      void SetColorEntry​(int entry, java.awt.Color centry)
      Set entry in color table.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ColorTable

        public ColorTable​(int ePaletteInterpretation)
        Construct a new color table.
    • Method Detail

      • delete

        public void delete()
      • clone

        public java.lang.Object clone()
        Make a copy of a color table.
      • getIndexColorModel

        public java.awt.image.IndexColorModel getIndexColorModel​(int bits)
      • Clone

        public ColorTable Clone()
        Make a copy of a color table.
      • GetPaletteInterpretation

        public int GetPaletteInterpretation()
        Fetch palette interpretation.

        The returned value is used to interpret the values in the GDALColorEntry.

        Returns:
        palette interpretation enumeration value, usually gdalconst.GPI_RGB.
      • GetCount

        public int GetCount()
        Get number of color entries in table.
        Returns:
        the number of color entries.
      • GetColorEntry

        public java.awt.Color GetColorEntry​(int entry)
        Fetch a color entry from table.
        Parameters:
        entry - entry offset from zero to GetCount()-1.
        Returns:
        color entry, or null if index is out of range.
      • SetColorEntry

        public void SetColorEntry​(int entry,
                                  java.awt.Color centry)
        Set entry in color table.

        The passed in entry must match the color interpretation of the table to which it is being assigned.

        The table is grown as needed to hold the supplied offset.

        Parameters:
        entry - entry offset from zero to GetCount()-1.
        centry - value to assign to table.
      • CreateColorRamp

        public void CreateColorRamp​(int nStartIndex,
                                    java.awt.Color startcolor,
                                    int nEndIndex,
                                    java.awt.Color endcolor)
        Create color ramp.

        Automatically creates a color ramp from one color entry to another. It can be called several times to create multiples ramps in the same color table.

        Parameters:
        nStartIndex - index to start the ramp on the color table [0..255]
        startcolor - a color value to start the ramp
        nEndIndex - index to end the ramp on the color table [0..255]
        endcolor - a color value to end the ramp