QGIS API Documentation  2.99.0-Master (01468d0)
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 
31 class CORE_EXPORT QgsRasterTransparency
32 {
33 
34  public:
35 
39  QgsRasterTransparency() = default;
40 
41  //
42  // Structs to hold transparent pixel vlaues
43  //
45  {
46  double red;
47  double green;
48  double blue;
50  };
51 
53  {
54  double min;
55  double max;
57  };
58 
59  //
60  // Initializer, Accessor and mutator for transparency tables.
61  //
63  QList<QgsRasterTransparency::TransparentSingleValuePixel> transparentSingleValuePixelList() const;
64 
66  QList<QgsRasterTransparency::TransparentThreeValuePixel> transparentThreeValuePixelList() const;
67 
69  void initializeTransparentPixelList( double );
70 
72  void initializeTransparentPixelList( double, double, double );
73 
75  void setTransparentSingleValuePixelList( const QList<QgsRasterTransparency::TransparentSingleValuePixel> &newList SIP_TRANSFER );
76 
78  void setTransparentThreeValuePixelList( const QList<QgsRasterTransparency::TransparentThreeValuePixel> &newList SIP_TRANSFER );
79 
81  int alphaValue( double, int globalTransparency = 255 ) const;
82 
84  int alphaValue( double, double, double, int globalTransparency = 255 ) const;
85 
87  bool isEmpty() const;
88 
92  void writeXml( QDomDocument &doc, QDomElement &parentElem ) const;
93 
97  void readXml( const QDomElement &elem );
98 
99  private:
101  QList<QgsRasterTransparency::TransparentThreeValuePixel> mTransparentThreeValuePixelList;
102 
104  QList<QgsRasterTransparency::TransparentSingleValuePixel> mTransparentSingleValuePixelList;
105 
106 };
107 #endif
#define SIP_TRANSFER
Definition: qgis_sip.h:36
Defines the list of pixel values to be considered as transparent or semi transparent when rendering r...