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
25typedef std::vector<int> Color;
26typedef std::vector<Color> Colors;
27
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
52bool 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
59bool 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
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:436
Various convenience functions for working with strings and string lists.
void * GDALDatasetH
Opaque type used for the C bindings of the C++ GDALDataset class.
Definition: gdal.h:376
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition: gdal.h:379
struct GDALNearblackOptions GDALNearblackOptions
Definition: gdal_utils.h:137