Skip to content
Permalink
Browse files

Fix transparency for WMS layers (fixes #12300)

  • Loading branch information
wonder-sk committed Jun 18, 2015
1 parent 7870815 commit dbfbc692838e768b13c970c7d777829883b4b841
Showing with 7 additions and 5 deletions.
  1. +7 −5 src/core/raster/qgssinglebandcolordatarenderer.cpp
@@ -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;

0 comments on commit dbfbc69

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