QGIS API Documentation  3.0.2-Girona (307d082)
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  //
64  QList<QgsRasterTransparency::TransparentSingleValuePixel> transparentSingleValuePixelList() const;
65 
67  QList<QgsRasterTransparency::TransparentThreeValuePixel> transparentThreeValuePixelList() const;
68 
70  void initializeTransparentPixelList( double );
71 
73  void initializeTransparentPixelList( double, double, double );
74 
76  void setTransparentSingleValuePixelList( const QList<QgsRasterTransparency::TransparentSingleValuePixel> &newList SIP_TRANSFER );
77 
79  void setTransparentThreeValuePixelList( const QList<QgsRasterTransparency::TransparentThreeValuePixel> &newList SIP_TRANSFER );
80 
82  int alphaValue( double, int globalTransparency = 255 ) const;
83 
85  int alphaValue( double, double, double, int globalTransparency = 255 ) const;
86 
88  bool isEmpty() const;
89 
93  void writeXml( QDomDocument &doc, QDomElement &parentElem ) const;
94 
98  void readXml( const QDomElement &elem );
99 
100  private:
102  QList<QgsRasterTransparency::TransparentThreeValuePixel> mTransparentThreeValuePixelList;
103 
105  QList<QgsRasterTransparency::TransparentSingleValuePixel> mTransparentSingleValuePixelList;
106 
107 };
108 #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...