Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: "color-merge" 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_MERGE_INCLUDED 14 : #define GDALALG_RASTER_COLOR_MERGE_INCLUDED 15 : 16 : #include "gdalalg_raster_pipeline.h" 17 : 18 : //! @cond Doxygen_Suppress 19 : 20 : /************************************************************************/ 21 : /* GDALRasterColorMergeAlgorithm */ 22 : /************************************************************************/ 23 : 24 : class GDALRasterColorMergeAlgorithm /* non final*/ 25 : : public GDALRasterPipelineStepAlgorithm 26 : { 27 : public: 28 : explicit GDALRasterColorMergeAlgorithm(bool standaloneStep = false); 29 : 30 : static constexpr const char *NAME = "color-merge"; 31 : static constexpr const char *DESCRIPTION = 32 : "Use a grayscale raster to replace the intensity of a RGB/RGBA dataset"; 33 : static constexpr const char *HELP_URL = 34 : "/programs/gdal_raster_color_merge.html"; 35 : 36 : private: 37 : bool RunStep(GDALPipelineStepRunContext &ctxt) override; 38 : 39 : GDALArgDatasetValue m_grayScaleDataset{}; 40 : }; 41 : 42 : /************************************************************************/ 43 : /* GDALRasterColorMergeAlgorithmStandalone */ 44 : /************************************************************************/ 45 : 46 40 : class GDALRasterColorMergeAlgorithmStandalone final 47 : : public GDALRasterColorMergeAlgorithm 48 : { 49 : public: 50 20 : GDALRasterColorMergeAlgorithmStandalone() 51 20 : : GDALRasterColorMergeAlgorithm(/* standaloneStep = */ true) 52 : { 53 20 : } 54 : 55 : ~GDALRasterColorMergeAlgorithmStandalone() override; 56 : }; 57 : 58 : //! @endcond 59 : 60 : #endif /* GDALALG_RASTER_COLOR_MERGE_INCLUDED */