Skip to content

Commit

Permalink
Fix for transparent values in singleband gray renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Jun 25, 2012
1 parent 8ff8da3 commit 6a7ab64
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/core/raster/qgssinglebandgrayrenderer.cpp
Expand Up @@ -122,6 +122,17 @@ void QgsSingleBandGrayRenderer::draw( QPainter* p, QgsRasterViewPort* viewPort,
{
grayVal = readValue( rasterData, rasterType, currentRasterPos );

//alpha
currentAlpha = mOpacity;
if ( mRasterTransparency )
{
currentAlpha = mRasterTransparency->alphaValue( grayVal, mOpacity * 255 ) / 255.0;
}
if ( mAlphaBand > 0 )
{
currentAlpha *= ( readValue( alphaData, alphaType, currentRasterPos ) / 255.0 );
}

if ( mContrastEnhancement )
{
if ( !mContrastEnhancement->isValueInDisplayableRange( grayVal ) )
Expand All @@ -138,17 +149,6 @@ void QgsSingleBandGrayRenderer::draw( QPainter* p, QgsRasterViewPort* viewPort,
grayVal = 255 - grayVal;
}

//alpha
currentAlpha = mOpacity;
if ( mRasterTransparency )
{
currentAlpha = mRasterTransparency->alphaValue( grayVal, mOpacity * 255 ) / 255.0;
}
if ( mAlphaBand > 0 )
{
currentAlpha *= ( readValue( alphaData, alphaType, currentRasterPos ) / 255.0 );
}

if ( doubleNear( currentAlpha, 255 ) )
{
imageScanLine[j] = qRgba( grayVal, grayVal, grayVal, 255 );
Expand Down

0 comments on commit 6a7ab64

Please sign in to comment.