GDAL
gdalalg_raster_color_map.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: "color-map" step of "raster pipeline"
5 * Author: Even Rouault <even dot rouault at spatialys.com>
6 *
7 ******************************************************************************
8 * Copyright (c) 2025, Even Rouault <even dot rouault at spatialys.com>
9 *
10 * SPDX-License-Identifier: MIT
11 ****************************************************************************/
12
13#ifndef GDALALG_RASTER_COLOR_MAP_INCLUDED
14#define GDALALG_RASTER_COLOR_MAP_INCLUDED
15
16#include "gdalalg_raster_pipeline.h"
17
18#include <limits>
19
21
22/************************************************************************/
23/* GDALRasterColorMapAlgorithm */
24/************************************************************************/
25
26class GDALRasterColorMapAlgorithm /* non final */
27 : public GDALRasterPipelineStepAlgorithm
28{
29 public:
30 static constexpr const char *NAME = "color-map";
31 static constexpr const char *DESCRIPTION =
32 "Generate a RGB or RGBA dataset from a single band, using a color "
33 "map";
34 static constexpr const char *HELP_URL =
35 "/programs/gdal_raster_color_map.html";
36
37 explicit GDALRasterColorMapAlgorithm(bool standaloneStep = false);
38
39 bool CanHandleNextStep(GDALPipelineStepAlgorithm *) const override;
40
41 private:
42 bool RunStep(GDALPipelineStepRunContext &ctxt) override;
43
44 int m_band = 1;
45 std::string m_colorMap{};
46 bool m_addAlpha = false;
47 std::string m_colorSelection = "interpolate";
48};
49
50/************************************************************************/
51/* GDALRasterColorMapAlgorithmStandalone */
52/************************************************************************/
53
54class GDALRasterColorMapAlgorithmStandalone final
55 : public GDALRasterColorMapAlgorithm
56{
57 public:
58 GDALRasterColorMapAlgorithmStandalone()
59 : GDALRasterColorMapAlgorithm(/* standaloneStep = */ true)
60 {
61 }
62
63 ~GDALRasterColorMapAlgorithmStandalone() override;
64};
65
67
68#endif /* GDALALG_RASTER_COLOR_MAP_INCLUDED */