QGIS API Documentation  3.2.0-Bonn (bc43194)
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 vlaues
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
Defines the list of pixel values to be considered as transparent or semi transparent when rendering r...