18#ifndef QGSRASTERTRANSPARENCY_H
19#define QGSRASTERTRANSPARENCY_H
58 TransparentThreeValuePixel(
double red = 0,
double green = 0,
double blue = 0,
double opacity = 0,
double fuzzyToleranceRed = 4 * std::numeric_limits<double>::epsilon(),
double fuzzyToleranceGreen = 4 * std::numeric_limits<double>::epsilon(),
double fuzzyToleranceBlue = 4 * std::numeric_limits<double>::epsilon() )
63 , fuzzyToleranceRed( fuzzyToleranceRed )
64 , fuzzyToleranceGreen( fuzzyToleranceGreen )
65 , fuzzyToleranceBlue( fuzzyToleranceBlue )
98 double fuzzyToleranceRed = 4 * std::numeric_limits<double>::epsilon();
100 double fuzzyToleranceRed;
111 double fuzzyToleranceGreen = 4 * std::numeric_limits<double>::epsilon();
113 double fuzzyToleranceGreen;
124 double fuzzyToleranceBlue = 4 * std::numeric_limits<double>::epsilon();
126 double fuzzyToleranceBlue;
141 return !( *
this == other );
145 SIP_PYOBJECT __repr__();
149 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 );
151 str = QStringLiteral(
"<QgsRasterTransparency.TransparentThreeValuePixel: %1, %2, %3, %4>" ).arg( sipCpp->red ).arg( sipCpp->green ).arg( sipCpp->blue ).arg( sipCpp->opacity );
152 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
178 , includeMinimum( includeMinimum )
179 , includeMaximum( includeMaximum )
205 bool includeMinimum =
true;
213 bool includeMaximum =
true;
224 return !( *
this == other );
228 SIP_PYOBJECT __repr__();
230 const QString
str = QStringLiteral(
"<QgsRasterTransparency.TransparentSingleValuePixel: %1, %2, %3>" ).arg( sipCpp->min ).arg( sipCpp->max ).arg( sipCpp->opacity );
231 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
240 QVector<QgsRasterTransparency::TransparentSingleValuePixel> transparentSingleValuePixelList()
const;
246 QVector<QgsRasterTransparency::TransparentThreeValuePixel> transparentThreeValuePixelList()
const;
251 void initializeTransparentPixelList(
double value );
256 void initializeTransparentPixelList(
double redValue,
double greenValue,
double blueValue );
262 void setTransparentSingleValuePixelList(
const QVector<QgsRasterTransparency::TransparentSingleValuePixel> &newList );
268 void setTransparentThreeValuePixelList(
const QVector<QgsRasterTransparency::TransparentThreeValuePixel> &newList );
281 Q_DECL_DEPRECATED
int alphaValue(
double value,
int globalTransparency = 255 ) const
SIP_DEPRECATED;
291 double opacityForValue(
double value ) const;
305 Q_DECL_DEPRECATED
int alphaValue(
double redValue,
double greenValue,
double blueValue,
int globalTransparency = 255 ) const
SIP_DEPRECATED;
317 double opacityForRgbValues(
double redValue,
double greenValue,
double blueValue ) const;
320 bool isEmpty() const;
325 void writeXml( QDomDocument &doc, QDomElement &parentElem ) const;
330 void readXml( const QDomElement &elem );
Defines the list of pixel values to be considered as transparent or semi transparent when rendering r...
QgsRasterTransparency()=default
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Defines the transparency for a range of single-band pixel values.
bool operator==(const QgsRasterTransparency::TransparentSingleValuePixel &other) const
TransparentSingleValuePixel(double minimum=0, double maximum=0, double opacity=0, bool includeMinimum=true, bool includeMaximum=true)
Constructor for TransparentSingleValuePixel.
double opacity
Opacity for pixel, between 0 and 1.0.
double min
Minimum pixel value to include in range.
double max
Maximum pixel value to include in range.
bool includeMaximum
true if pixels matching the max value should be considered transparent, or false if only pixels less ...
bool operator!=(const QgsRasterTransparency::TransparentSingleValuePixel &other) const
bool includeMinimum
true if pixels matching the min value should be considered transparent, or false if only pixels great...
Defines the transparency for a RGB pixel value.
TransparentThreeValuePixel(double red=0, double green=0, double blue=0, double opacity=0, double fuzzyToleranceRed=4 *std::numeric_limits< double >::epsilon(), double fuzzyToleranceGreen=4 *std::numeric_limits< double >::epsilon(), double fuzzyToleranceBlue=4 *std::numeric_limits< double >::epsilon())
Constructor for TransparentThreeValuePixel.
bool operator!=(const QgsRasterTransparency::TransparentThreeValuePixel &other) const
double fuzzyToleranceRed
Fuzzy tolerance for red values.
double opacity
Opacity for pixel, between 0 and 1.0.
double red
Red pixel value.
double fuzzyToleranceBlue
Fuzzy tolerance for blue values.
double green
Green pixel value.
bool operator==(const QgsRasterTransparency::TransparentThreeValuePixel &other) const
double fuzzyToleranceGreen
Fuzzy tolerance for green values.
double blue
Blue pixel value.