Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix transparency for WMS layers (fixes #12300)
(cherry picked from commit dbfbc69)
  • Loading branch information
wonder-sk committed Jul 7, 2015
1 parent 5c2f9e6 commit 507b9f2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/core/raster/qgssinglebandcolordatarenderer.cpp
Expand Up @@ -87,13 +87,15 @@ QgsRasterBlock* QgsSingleBandColorDataRenderer::block( int bandNo, QgsRectangle
return outputBlock;
}

// make sure input is also premultiplied!
inputBlock->convert( QGis::ARGB32_Premultiplied );

QRgb* inputBits = ( QRgb* )inputBlock->bits();
QRgb* outputBits = ( QRgb* )outputBlock->bits();
for ( qgssize i = 0; i < ( qgssize )width*height; i++ )
{
QRgb pixelColor;
QRgb c = inputBlock->color( i );
double alpha = qAlpha( c );
pixelColor = qRgba( mOpacity * qRed( c ), mOpacity * qGreen( c ), mOpacity * qBlue( c ), mOpacity * alpha );
outputBlock->setColor( i, pixelColor );
QRgb c = inputBits[i];
outputBits[i] = qRgba( mOpacity * qRed( c ), mOpacity * qGreen( c ), mOpacity * qBlue( c ), mOpacity * qAlpha( c ) );
}

delete inputBlock;
Expand Down

0 comments on commit 507b9f2

Please sign in to comment.