Skip to content

Commit 233a95e

Browse files
committed
Raster API opacity documentation
1 parent 32480fe commit 233a95e

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/core/raster/qgsrasterrenderer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ const QRgb QgsRasterRenderer::NODATA_COLOR = qRgba( 0, 0, 0, 0 );
2929

3030
QgsRasterRenderer::QgsRasterRenderer( QgsRasterInterface *input, const QString &type )
3131
: QgsRasterInterface( input )
32-
, mType( type ), mOpacity( 1.0 ), mRasterTransparency( nullptr )
32+
, mType( type )
33+
, mRasterTransparency( nullptr )
3334
, mAlphaBand( -1 ) //, mInvertColor( false )
3435
{
3536
}

src/core/raster/qgsrasterrenderer.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,18 @@ class CORE_EXPORT QgsRasterRenderer : public QgsRasterInterface
6464

6565
bool usesTransparency() const;
6666

67+
/**
68+
* Sets the \a opacity for the renderer, where \a opacity is a value between 0 (totally transparent)
69+
* and 1.0 (fully opaque).
70+
* \see opacity()
71+
*/
6772
void setOpacity( double opacity ) { mOpacity = opacity; }
73+
74+
/**
75+
* Returns the opacity for the renderer, where opacity is a value between 0 (totally transparent)
76+
* and 1.0 (fully opaque).
77+
* \see setOpacity()
78+
*/
6879
double opacity() const { return mOpacity; }
6980

7081
void setRasterTransparency( QgsRasterTransparency *t );
@@ -101,7 +112,7 @@ class CORE_EXPORT QgsRasterRenderer : public QgsRasterInterface
101112
QString mType;
102113

103114
//! Global alpha value (0-1)
104-
double mOpacity;
115+
double mOpacity = 1.0;
105116
//! Raster transparency per color or value. Overwrites global alpha value
106117
QgsRasterTransparency *mRasterTransparency = nullptr;
107118

0 commit comments

Comments
 (0)