Skip to content
Permalink
Browse files

Raster API opacity documentation

  • Loading branch information
nyalldawson committed May 29, 2017
1 parent 32480fe commit 233a95e99b3b3d8b081e5bf89581235c5b9b3aa2
Showing with 14 additions and 2 deletions.
  1. +2 −1 src/core/raster/qgsrasterrenderer.cpp
  2. +12 −1 src/core/raster/qgsrasterrenderer.h
@@ -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 )
{
}
@@ -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 );
@@ -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;

0 comments on commit 233a95e

Please sign in to comment.
You can’t perform that action at this time.