#include <gdal_priv.h>
Public Member Functions | |
GDALColorTable (GDALPaletteInterp=GPI_RGB) | |
~GDALColorTable () | |
GDALColorTable * | Clone () const |
GDALPaletteInterp | GetPaletteInterpretation () const |
int | GetColorEntryCount () const |
const GDALColorEntry * | GetColorEntry (int) const |
int | GetColorEntryAsRGB (int, GDALColorEntry *) const |
void | SetColorEntry (int, const GDALColorEntry *) |
int | CreateColorRamp (int, const GDALColorEntry *, int, const GDALColorEntry *) |
A color table / palette.
GDALColorTable::GDALColorTable | ( | GDALPaletteInterp | eInterpIn = GPI_RGB |
) |
Construct a new color table.
This constructor is the same as the C GDALCreateColorTable() function.
eInterpIn | the interpretation to be applied to GDALColorEntry values. |
Referenced by Clone().
GDALColorTable::~GDALColorTable | ( | ) |
Destructor.
This descructor is the same as the C GDALDestroyColorTable() function.
GDALColorTable * GDALColorTable::Clone | ( | ) | const |
Make a copy of a color table.
This method is the same as the C function GDALCloneColorTable().
References GDALColorTable().
Referenced by GDALProxyPoolRasterBand::GetColorTable(), VRTRasterBand::SetColorTable(), and GDALPamRasterBand::SetColorTable().
int GDALColorTable::CreateColorRamp | ( | int | nStartIndex, | |
const GDALColorEntry * | psStartColor, | |||
int | nEndIndex, | |||
const GDALColorEntry * | psEndColor | |||
) |
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.
This function is the same as the C function GDALCreateColorRamp().
nStartIndex | index to start the ramp on the color table [0..255] | |
psStartColor | a color entry value to start the ramp | |
nEndIndex | index to end the ramp on the color table [0..255] | |
psEndColor | a color entry value to end the ramp |
References GDALColorEntry::c1, GDALColorEntry::c2, GDALColorEntry::c3, GDALColorEntry::c4, GetColorEntryCount(), and SetColorEntry().
const GDALColorEntry * GDALColorTable::GetColorEntry | ( | int | i | ) | const |
Fetch a color entry from table.
This method is the same as the C function GDALGetColorEntry().
i | entry offset from zero to GetColorEntryCount()-1. |
Referenced by GDALRasterBand::GetIndexColorTranslationTo().
int GDALColorTable::GetColorEntryAsRGB | ( | int | i, | |
GDALColorEntry * | poEntry | |||
) | const |
Fetch a table entry in RGB format.
In theory this method should support translation of color palettes in non-RGB color spaces into RGB on the fly, but currently it only works on RGB color tables.
This method is the same as the C function GDALGetColorEntryAsRGB().
i | entry offset from zero to GetColorEntryCount()-1. | |
poEntry | the existing GDALColorEntry to be overrwritten with the RGB values. |
References GPI_RGB.
Referenced by GDALRasterAttributeTable::InitializeFromColorTable().
int GDALColorTable::GetColorEntryCount | ( | ) | const |
Get number of color entries in table.
This method is the same as the function GDALGetColorEntryCount().
Referenced by CreateColorRamp(), GDALRasterBand::GetIndexColorTranslationTo(), and GDALRasterAttributeTable::InitializeFromColorTable().
GDALPaletteInterp GDALColorTable::GetPaletteInterpretation | ( | ) | const |
Fetch palette interpretation.
The returned value is used to interprete the values in the GDALColorEntry.
This method is the same as the C function GDALGetPaletteInterpretation().
Referenced by GDALRegenerateOverviews().
void GDALColorTable::SetColorEntry | ( | int | i, | |
const GDALColorEntry * | poEntry | |||
) |
Set entry in color table.
Note that the passed in color entry is copied, and no internal reference to it is maintained. Also, 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.
This function is the same as the C function GDALSetColorEntry().
i | entry offset from zero to GetColorEntryCount()-1. | |
poEntry | value to assign to table. |
References GDALColorEntry::c1, GDALColorEntry::c2, GDALColorEntry::c3, and GDALColorEntry::c4.
Referenced by CreateColorRamp(), and GDALRasterAttributeTable::TranslateToColorTable().