QGIS API Documentation  2.99.0-Master (40f86b2)
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 <QList>
23 class QDomDocument;
24 class QDomElement;
25 
30 class CORE_EXPORT QgsRasterTransparency
31 {
32 
33  public:
35 
36  //
37  // Structs to hold transparent pixel vlaues
38  //
40  {
41  double red;
42  double green;
43  double blue;
45  };
46 
48  {
49  double min;
50  double max;
52  };
53 
54  //
55  // Initializer, Accessor and mutator for transparency tables.
56  //
58  QList<QgsRasterTransparency::TransparentSingleValuePixel> transparentSingleValuePixelList() const;
59 
61  QList<QgsRasterTransparency::TransparentThreeValuePixel> transparentThreeValuePixelList() const;
62 
64  void initializeTransparentPixelList( double );
65 
67  void initializeTransparentPixelList( double, double, double );
68 
70  void setTransparentSingleValuePixelList( const QList<TransparentSingleValuePixel> &newList );
71 
73  void setTransparentThreeValuePixelList( const QList<TransparentThreeValuePixel> &newList );
74 
76  int alphaValue( double, int globalTransparency = 255 ) const;
77 
79  int alphaValue( double, double, double, int globalTransparency = 255 ) const;
80 
82  bool isEmpty() const;
83 
84  void writeXml( QDomDocument &doc, QDomElement &parentElem ) const;
85 
86  void readXml( const QDomElement &elem );
87 
88  private:
90  QList<QgsRasterTransparency::TransparentThreeValuePixel> mTransparentThreeValuePixelList;
91 
93  QList<QgsRasterTransparency::TransparentSingleValuePixel> mTransparentSingleValuePixelList;
94 
95 };
96 #endif
Defines the list of pixel values to be considered as transparent or semi transparent when rendering r...