Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Raster API opacity documentation
  • Loading branch information
nyalldawson committed May 29, 2017
1 parent 32480fe commit 233a95e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/core/raster/qgsrasterrenderer.cpp
Expand Up @@ -29,7 +29,8 @@ const QRgb QgsRasterRenderer::NODATA_COLOR = qRgba( 0, 0, 0, 0 );

QgsRasterRenderer::QgsRasterRenderer( QgsRasterInterface *input, const QString &type )
: QgsRasterInterface( input )
, mType( type ), mOpacity( 1.0 ), mRasterTransparency( nullptr )
, mType( type )
, mRasterTransparency( nullptr )
, mAlphaBand( -1 ) //, mInvertColor( false )
{
}
Expand Down
13 changes: 12 additions & 1 deletion src/core/raster/qgsrasterrenderer.h
Expand Up @@ -64,7 +64,18 @@ class CORE_EXPORT QgsRasterRenderer : public QgsRasterInterface

bool usesTransparency() const;

/**
* Sets the \a opacity for the renderer, where \a opacity is a value between 0 (totally transparent)
* and 1.0 (fully opaque).
* \see opacity()
*/
void setOpacity( double opacity ) { mOpacity = opacity; }

/**
* Returns the opacity for the renderer, where opacity is a value between 0 (totally transparent)
* and 1.0 (fully opaque).
* \see setOpacity()
*/
double opacity() const { return mOpacity; }

void setRasterTransparency( QgsRasterTransparency *t );
Expand Down Expand Up @@ -101,7 +112,7 @@ class CORE_EXPORT QgsRasterRenderer : public QgsRasterInterface
QString mType;

//! Global alpha value (0-1)
double mOpacity;
double mOpacity = 1.0;
//! Raster transparency per color or value. Overwrites global alpha value
QgsRasterTransparency *mRasterTransparency = nullptr;

Expand Down

0 comments on commit 233a95e

Please sign in to comment.