GDAL
gdalalg_raster_blend.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: "blend" 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_BLEND_INCLUDED
14#define GDALALG_RASTER_BLEND_INCLUDED
15
16#include "gdalalg_raster_pipeline.h"
17
19
20/************************************************************************/
21/* GDALRasterBlendAlgorithm */
22/************************************************************************/
23
24class GDALRasterBlendAlgorithm /* non final*/
25 : public GDALRasterPipelineStepAlgorithm
26{
27 public:
28 explicit GDALRasterBlendAlgorithm(bool standaloneStep = false);
29
30 static constexpr const char *NAME = "blend";
31 static constexpr const char *DESCRIPTION =
32 "Blend/compose two raster datasets";
33 static constexpr const char *HELP_URL = "/programs/gdal_raster_blend.html";
34
35 private:
36 bool RunStep(GDALPipelineStepRunContext &ctxt) override;
37 bool ValidateGlobal();
38
39 GDALArgDatasetValue m_overlayDataset{};
40 std::string m_operator{};
41 static constexpr int OPACITY_INPUT_RANGE = 100;
42 int m_opacity = OPACITY_INPUT_RANGE;
43};
44
45/************************************************************************/
46/* GDALRasterBlendAlgorithmStandalone */
47/************************************************************************/
48
49class GDALRasterBlendAlgorithmStandalone final : public GDALRasterBlendAlgorithm
50{
51 public:
52 GDALRasterBlendAlgorithmStandalone()
53 : GDALRasterBlendAlgorithm(/* standaloneStep = */ true)
54 {
55 }
56
57 ~GDALRasterBlendAlgorithmStandalone() override;
58};
59
61
62#endif /* GDALALG_RASTER_COLOR_MERGE_INCLUDED */