mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-04 00:04:25 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			222 lines
		
	
	
		
			8.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			222 lines
		
	
	
		
			8.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
/************************************************************************
 | 
						|
 * This file has been generated automatically from                      *
 | 
						|
 *                                                                      *
 | 
						|
 * src/core/raster/qgsrastertransparency.h                              *
 | 
						|
 *                                                                      *
 | 
						|
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 | 
						|
 ************************************************************************/
 | 
						|
 | 
						|
 | 
						|
 | 
						|
class QgsRasterTransparency
 | 
						|
{
 | 
						|
%Docstring(signature="appended")
 | 
						|
Defines the list of pixel values to be considered as transparent or semi
 | 
						|
transparent when rendering rasters.
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgsrastertransparency.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
 | 
						|
    QgsRasterTransparency();
 | 
						|
 | 
						|
    struct TransparentThreeValuePixel
 | 
						|
    {
 | 
						|
 | 
						|
      TransparentThreeValuePixel( double red = 0, double green = 0, double blue = 0, double opacity = 0, double fuzzyToleranceRed = 4 * DBL_EPSILON, double fuzzyToleranceGreen = 4 * DBL_EPSILON, double fuzzyToleranceBlue = 4 * DBL_EPSILON );
 | 
						|
%Docstring
 | 
						|
Constructor for TransparentThreeValuePixel.
 | 
						|
 | 
						|
:param red: red pixel value
 | 
						|
:param green: green pixel value
 | 
						|
:param blue: blue pixel value
 | 
						|
:param opacity: opacity for pixel, between 0 and 1.0
 | 
						|
:param fuzzyToleranceRed: (since QGIS 3.40) allows specifying a tolerance for the red color component, where the pixel's red component can deviate from values specified here by a maximum of this tolerance amount
 | 
						|
:param fuzzyToleranceGreen: (since QGIS 3.40) allows specifying a tolerance for the green color component, where the pixel's green component can deviate from values specified here by a maximum of this tolerance amount
 | 
						|
:param fuzzyToleranceBlue: (since QGIS 3.40) allows specifying a tolerance for the blue color component, where the pixel's blue component can deviate from values specified here by a maximum of this tolerance amount
 | 
						|
 | 
						|
.. versionadded:: 3.38
 | 
						|
%End
 | 
						|
 | 
						|
      double red;
 | 
						|
 | 
						|
      double green;
 | 
						|
 | 
						|
      double blue;
 | 
						|
 | 
						|
      double opacity;
 | 
						|
 | 
						|
      double fuzzyToleranceRed;
 | 
						|
 | 
						|
      double fuzzyToleranceGreen;
 | 
						|
 | 
						|
      double fuzzyToleranceBlue;
 | 
						|
 | 
						|
      bool operator==( const QgsRasterTransparency::TransparentThreeValuePixel &other ) const;
 | 
						|
      bool operator!=( const QgsRasterTransparency::TransparentThreeValuePixel &other ) const;
 | 
						|
 | 
						|
      SIP_PYOBJECT __repr__();
 | 
						|
%MethodCode
 | 
						|
      QString str;
 | 
						|
      if ( !qgsDoubleNear( sipCpp->fuzzyToleranceRed, 0 ) || !qgsDoubleNear( sipCpp->fuzzyToleranceGreen, 0 ) || !qgsDoubleNear( sipCpp->fuzzyToleranceBlue, 0 ) )
 | 
						|
        str = QStringLiteral( "<QgsRasterTransparency.TransparentThreeValuePixel: %1, %2, %3, %4, %5, %6, %7>" ).arg( sipCpp->red ).arg( sipCpp->green ).arg( sipCpp->blue ).arg( sipCpp->opacity ).arg( sipCpp->fuzzyToleranceRed ).arg( sipCpp->fuzzyToleranceGreen ).arg( sipCpp->fuzzyToleranceBlue );
 | 
						|
      else
 | 
						|
        str = QStringLiteral( "<QgsRasterTransparency.TransparentThreeValuePixel: %1, %2, %3, %4>" ).arg( sipCpp->red ).arg( sipCpp->green ).arg( sipCpp->blue ).arg( sipCpp->opacity );
 | 
						|
      sipRes = PyUnicode_FromString( str.toUtf8().constData() );
 | 
						|
%End
 | 
						|
    };
 | 
						|
 | 
						|
    struct TransparentSingleValuePixel
 | 
						|
    {
 | 
						|
 | 
						|
      TransparentSingleValuePixel( double minimum = 0, double maximum = 0, double opacity = 0, bool includeMinimum = true, bool includeMaximum = true );
 | 
						|
%Docstring
 | 
						|
Constructor for TransparentSingleValuePixel.
 | 
						|
 | 
						|
:param minimum: minimum pixel value to include in range
 | 
						|
:param maximum: maximum pixel value to include in range
 | 
						|
:param opacity: opacity for pixel, between 0 and 1.0
 | 
						|
:param includeMinimum: whether the minimum value should be included in the range
 | 
						|
:param includeMaximum: whether the maximum value should be included in the range
 | 
						|
 | 
						|
.. versionadded:: 3.38
 | 
						|
%End
 | 
						|
 | 
						|
      double min;
 | 
						|
 | 
						|
      double max;
 | 
						|
 | 
						|
      double opacity;
 | 
						|
 | 
						|
      bool includeMinimum;
 | 
						|
 | 
						|
      bool includeMaximum;
 | 
						|
 | 
						|
      bool operator==( const QgsRasterTransparency::TransparentSingleValuePixel &other ) const;
 | 
						|
      bool operator!=( const QgsRasterTransparency::TransparentSingleValuePixel &other ) const;
 | 
						|
 | 
						|
      SIP_PYOBJECT __repr__();
 | 
						|
%MethodCode
 | 
						|
      const QString str = QStringLiteral( "<QgsRasterTransparency.TransparentSingleValuePixel: %1, %2, %3>" ).arg( sipCpp->min ).arg( sipCpp->max ).arg( sipCpp->opacity );
 | 
						|
      sipRes = PyUnicode_FromString( str.toUtf8().constData() );
 | 
						|
%End
 | 
						|
    };
 | 
						|
 | 
						|
    QVector<QgsRasterTransparency::TransparentSingleValuePixel> transparentSingleValuePixelList() const;
 | 
						|
%Docstring
 | 
						|
Returns the transparent single value pixel list.
 | 
						|
 | 
						|
.. seealso:: :py:func:`setTransparentSingleValuePixelList`
 | 
						|
%End
 | 
						|
 | 
						|
    QVector<QgsRasterTransparency::TransparentThreeValuePixel> transparentThreeValuePixelList() const;
 | 
						|
%Docstring
 | 
						|
Returns the transparent three value pixel list.
 | 
						|
 | 
						|
.. seealso:: :py:func:`setTransparentThreeValuePixelList`
 | 
						|
%End
 | 
						|
 | 
						|
    void initializeTransparentPixelList( double value );
 | 
						|
%Docstring
 | 
						|
Resets the transparency list to a single ``value``.
 | 
						|
%End
 | 
						|
 | 
						|
    void initializeTransparentPixelList( double redValue, double greenValue, double blueValue );
 | 
						|
%Docstring
 | 
						|
Resets the transparency list to single red, green, and blue values.
 | 
						|
%End
 | 
						|
 | 
						|
    void setTransparentSingleValuePixelList( const QVector<QgsRasterTransparency::TransparentSingleValuePixel> &newList );
 | 
						|
%Docstring
 | 
						|
Sets the transparent single value pixel list, replacing the whole existing list.
 | 
						|
 | 
						|
.. seealso:: :py:func:`transparentSingleValuePixelList`
 | 
						|
%End
 | 
						|
 | 
						|
    void setTransparentThreeValuePixelList( const QVector<QgsRasterTransparency::TransparentThreeValuePixel> &newList );
 | 
						|
%Docstring
 | 
						|
Sets the transparent three value pixel list, replacing the whole existing list.
 | 
						|
 | 
						|
.. seealso:: :py:func:`transparentThreeValuePixelList`
 | 
						|
%End
 | 
						|
 | 
						|
 int alphaValue( double value, int globalTransparency = 255 ) const /Deprecated/;
 | 
						|
%Docstring
 | 
						|
Returns the transparency value for a single ``value`` pixel.
 | 
						|
 | 
						|
Searches through the transparency list, and if a match is found, the global transparency value is scaled
 | 
						|
by the stored transparency value.
 | 
						|
 | 
						|
:param value: the needle to search for in the transparency hay stack
 | 
						|
:param globalTransparency: the overall transparency level for the layer
 | 
						|
 | 
						|
.. deprecated:: 3.40
 | 
						|
 | 
						|
   Use :py:func:`~QgsRasterTransparency.opacityForValue` instead.
 | 
						|
%End
 | 
						|
 | 
						|
    double opacityForValue( double value ) const;
 | 
						|
%Docstring
 | 
						|
Returns the opacity (as a value from 0 to 1) for a single ``value`` pixel.
 | 
						|
 | 
						|
Searches through the transparency list, and if a match is found, returns
 | 
						|
the opacity corresponding to the value. Returns 1 if no matches are found.
 | 
						|
 | 
						|
.. versionadded:: 3.38
 | 
						|
%End
 | 
						|
 | 
						|
 int alphaValue( double redValue, double greenValue, double blueValue, int globalTransparency = 255 ) const /Deprecated/;
 | 
						|
%Docstring
 | 
						|
Returns the transparency value for a RGB pixel.
 | 
						|
 | 
						|
Searches through the transparency list, if a match is found, the global transparency value is scaled
 | 
						|
by the stored transparency value.
 | 
						|
 | 
						|
:param redValue: the red portion of the needle to search for in the transparency hay stack
 | 
						|
:param greenValue: the green portion of the needle to search for in the transparency hay stack
 | 
						|
:param blueValue: the green portion of the needle to search for in the transparency hay stack
 | 
						|
:param globalTransparency: the overall transparency level for the layer
 | 
						|
 | 
						|
.. deprecated:: 3.40
 | 
						|
 | 
						|
   Use :py:func:`~QgsRasterTransparency.opacityForRgbValues` instead.
 | 
						|
%End
 | 
						|
 | 
						|
    double opacityForRgbValues( double redValue, double greenValue, double blueValue ) const;
 | 
						|
%Docstring
 | 
						|
Returns the opacity (as a value from 0 to 1) for a set of RGB pixel values.
 | 
						|
 | 
						|
Searches through the transparency list, and if a match is found, returns
 | 
						|
the opacity corresponding to the values. Returns 1 if no matches are found.
 | 
						|
 | 
						|
If any of the red, green or blue values are NaN, 0 will be returned.
 | 
						|
 | 
						|
.. versionadded:: 3.38
 | 
						|
%End
 | 
						|
 | 
						|
    bool isEmpty() const;
 | 
						|
%Docstring
 | 
						|
True if there are no entries in the pixel lists except the nodata value
 | 
						|
%End
 | 
						|
 | 
						|
    void writeXml( QDomDocument &doc, QDomElement &parentElem ) const;
 | 
						|
%Docstring
 | 
						|
Writes the transparency information to an XML document.
 | 
						|
%End
 | 
						|
 | 
						|
    void readXml( const QDomElement &elem );
 | 
						|
%Docstring
 | 
						|
Reads the transparency information from an XML document.
 | 
						|
%End
 | 
						|
 | 
						|
};
 | 
						|
/************************************************************************
 | 
						|
 * This file has been generated automatically from                      *
 | 
						|
 *                                                                      *
 | 
						|
 * src/core/raster/qgsrastertransparency.h                              *
 | 
						|
 *                                                                      *
 | 
						|
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 | 
						|
 ************************************************************************/
 |