GDAL
gdal_colortable.h
1/******************************************************************************
2 *
3 * Name: gdal_colortable.h
4 * Project: GDAL Core
5 * Purpose: Declaration of GDALColorTable class
6 * Author: Frank Warmerdam, warmerdam@pobox.com
7 *
8 ******************************************************************************
9 * Copyright (c) 1998, Frank Warmerdam
10 * Copyright (c) 2007-2014, Even Rouault <even dot rouault at spatialys.com>
11 *
12 * SPDX-License-Identifier: MIT
13 ****************************************************************************/
14
15#ifndef GDALCOLORTABLE_H_INCLUDED
16#define GDALCOLORTABLE_H_INCLUDED
17
18#include "cpl_port.h"
19
20#include "gdal.h"
21
22#include <memory>
23#include <vector>
24
25/* ******************************************************************** */
26/* GDALColorTable */
27/* ******************************************************************** */
28
31class CPL_DLL GDALColorTable
32{
33 GDALPaletteInterp eInterp;
34
35 std::vector<GDALColorEntry> aoEntries{};
36
37 public:
39
41 GDALColorTable(const GDALColorTable &) = default;
42
45
48
51
53
54 GDALColorTable *Clone() const;
55 int IsSame(const GDALColorTable *poOtherCT) const;
56
57 GDALPaletteInterp GetPaletteInterpretation() const;
58
59 int GetColorEntryCount() const;
60 const GDALColorEntry *GetColorEntry(int i) const;
61 int GetColorEntryAsRGB(int i, GDALColorEntry *poEntry) const;
62 void SetColorEntry(int i, const GDALColorEntry *poEntry);
63 int CreateColorRamp(int nStartIndex, const GDALColorEntry *psStartColor,
64 int nEndIndex, const GDALColorEntry *psEndColor);
65 bool IsIdentity() const;
66
67 static std::unique_ptr<GDALColorTable>
68 LoadFromFile(const char *pszFilename);
69
73 {
74 return static_cast<GDALColorTableH>(poCT);
75 }
76
80 {
81 return static_cast<GDALColorTable *>(hCT);
82 }
83};
84
85#endif
A color table / palette.
Definition gdal_colortable.h:32
static GDALColorTableH ToHandle(GDALColorTable *poCT)
Convert a GDALColorTable* to a GDALRasterBandH.
Definition gdal_colortable.h:72
GDALColorTable(const GDALColorTable &)=default
Copy constructor.
GDALColorTable & operator=(const GDALColorTable &)=default
Copy assignment operator.
~GDALColorTable()
Destructor.
GDALColorTable(GDALColorTable &&)=default
Move constructor.
GDALColorTable & operator=(GDALColorTable &&)=default
Move assignment operator.
static GDALColorTable * FromHandle(GDALColorTableH hCT)
Convert a GDALColorTableH to a GDALColorTable*.
Definition gdal_colortable.h:79
Core portability definitions for CPL.
Public (C callable) GDAL entry points.
GDALPaletteInterp
Definition gdal.h:377
@ GPI_RGB
Definition gdal.h:379
void * GDALColorTableH
Opaque type used for the C bindings of the C++ GDALColorTable class.
Definition gdal_fwd.h:54
Color tuple.
Definition gdal.h:2243