QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsrastertransparency.h
Go to the documentation of this file.
1 /* **************************************************************************
2  qgsrastertransparency.h - description
3  -------------------
4 begin : Mon Nov 30 2007
5 copyright : (C) 2007 by Peter J. Ersts
6 email : [email protected]
7 
8 ****************************************************************************/
9 
10 /* **************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 #ifndef QGSRASTERTRANSPARENCY_H
19 #define QGSRASTERTRANSPARENCY_H
20 
21 #include "qgis_core.h"
22 #include "qgis_sip.h"
23 #include <QList>
24 class QDomDocument;
25 class QDomElement;
26 
32 class CORE_EXPORT QgsRasterTransparency
33 {
34 
35  public:
36 
40  QgsRasterTransparency() = default;
41 
42  //
43  // Structs to hold transparent pixel values
44  //
46  {
47  double red;
48  double green;
49  double blue;
51  };
52 
54  {
55  double min;
56  double max;
58  };
59 
60  //
61  // Initializer, Accessor and mutator for transparency tables.
62  //
63 
68  QList<QgsRasterTransparency::TransparentSingleValuePixel> transparentSingleValuePixelList() const;
69 
74  QList<QgsRasterTransparency::TransparentThreeValuePixel> transparentThreeValuePixelList() const;
75 
79  void initializeTransparentPixelList( double value );
80 
84  void initializeTransparentPixelList( double redValue, double greenValue, double blueValue );
85 
90  void setTransparentSingleValuePixelList( const QList<QgsRasterTransparency::TransparentSingleValuePixel> &newList );
91 
96  void setTransparentThreeValuePixelList( const QList<QgsRasterTransparency::TransparentThreeValuePixel> &newList );
97 
107  int alphaValue( double value, int globalTransparency = 255 ) const;
108 
110 
121  int alphaValue( double redValue, double greenValue, double blueValue, int globalTransparency = 255 ) const;
122 
124  bool isEmpty() const;
125 
129  void writeXml( QDomDocument &doc, QDomElement &parentElem ) const;
130 
134  void readXml( const QDomElement &elem );
135 
136  private:
138  QList<QgsRasterTransparency::TransparentThreeValuePixel> mTransparentThreeValuePixelList;
139 
141  QList<QgsRasterTransparency::TransparentSingleValuePixel> mTransparentSingleValuePixelList;
142 
143 };
144 #endif
QgsRasterTransparency::TransparentSingleValuePixel::min
double min
Definition: qgsrastertransparency.h:55
QgsRasterTransparency::TransparentThreeValuePixel::percentTransparent
double percentTransparent
Definition: qgsrastertransparency.h:50
QgsRasterTransparency::TransparentSingleValuePixel::percentTransparent
double percentTransparent
Definition: qgsrastertransparency.h:57
QgsRasterTransparency::TransparentThreeValuePixel::blue
double blue
Definition: qgsrastertransparency.h:49
qgis_sip.h
QgsRasterTransparency::TransparentSingleValuePixel::max
double max
Definition: qgsrastertransparency.h:56
QgsRasterTransparency::TransparentSingleValuePixel
Definition: qgsrastertransparency.h:53
QgsRasterTransparency
Definition: qgsrastertransparency.h:32
QgsRasterTransparency::TransparentThreeValuePixel
Definition: qgsrastertransparency.h:45
QgsRasterTransparency::TransparentThreeValuePixel::red
double red
Definition: qgsrastertransparency.h:47
QgsRasterTransparency::TransparentThreeValuePixel::green
double green
Definition: qgsrastertransparency.h:48