GDAL

nearblack_lib.h
1/******************************************************************************
2 *
3 * Project: GDAL Utilities
4 * Purpose: Convert nearly black or nearly white border to exact black/white.
5 * Author: Frank Warmerdam, warmerdam@pobox.com
6 *
7 * ****************************************************************************
8 * Copyright (c) 2006, MapShots Inc (www.mapshots.com)
9 * Copyright (c) 2007-2013, Even Rouault <even dot rouault at spatialys.com>
10 *
11 * SPDX-License-Identifier: MIT
12 ****************************************************************************/
13
14#ifndef NEARBLACK_LIB_H
15#define NEARBLACK_LIB_H
16
17#ifndef DOXYGEN_SKIP
18
19#include "cpl_progress.h"
20#include "cpl_string.h"
21
22#include <string>
23#include <vector>
24
25 typedef std::vector<int> Color;
26 typedef std::vector<Color> Colors;
27
28 struct GDALNearblackOptions
29{
31 std::string osFormat{};
32
34 GDALProgressFunc pfnProgress = GDALDummyProgress;
35
37 void *pProgressData = nullptr;
38
39 int nMaxNonBlack = 2;
40 int nNearDist = 15;
41 bool bNearWhite = false;
42 bool bSetAlpha = false;
43 bool bSetMask = false;
44
45 bool bFloodFill = false;
46
47 Colors oColors{};
48
49 CPLStringList aosCreationOptions{};
50};
51
52 bool GDALNearblackTwoPassesAlgorithm(const GDALNearblackOptions *psOptions,
53 GDALDatasetH hSrcDataset,
54 GDALDatasetH hDstDS,
55 GDALRasterBandH hMaskBand, int nBands,
56 int nDstBands, bool bSetMask,
57 const Colors &oColors);
58
59 bool GDALNearblackFloodFill(const GDALNearblackOptions *psOptions,
60 GDALDatasetH hSrcDataset, GDALDatasetH hDstDS,
61 GDALRasterBandH hMaskBand, int nSrcBands,
62 int nDstBands, bool bSetMask,
63 const Colors &oColors);
64
65#endif // DOXYGEN_SKIP
66
67#endif // NEARBLACK_LIB_H
CPLStringList
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:436
cpl_string.h
Various convenience functions for working with strings and string lists.
GDALDatasetH
void * GDALDatasetH
Opaque type used for the C bindings of the C++ GDALDataset class.
Definition: gdal.h:376
GDALRasterBandH
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition: gdal.h:379
GDALNearblackOptions
struct GDALNearblackOptions GDALNearblackOptions
Definition: gdal_utils.h:137