Skip to content
Permalink
Browse files

Fix for transparent values in singleband gray renderer

  • Loading branch information
mhugent committed Jun 25, 2012
1 parent 8ff8da3 commit 6a7ab642e90dc67c65c18ff3a5f8d88dcfdc6dab
Showing with 11 additions and 11 deletions.
  1. +11 −11 src/core/raster/qgssinglebandgrayrenderer.cpp
@@ -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 ) )
@@ -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 );

0 comments on commit 6a7ab64

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