Skip to content

Commit c8a05c1

Browse files
committedOct 4, 2012
auto set alpha band
1 parent f3acfda commit c8a05c1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎src/core/raster/qgsrasterlayer.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,6 +1847,19 @@ void QgsRasterLayer::setDataProvider( QString const & provider )
18471847
setDrawingStyle( SingleBandGray ); //sensible default
18481848
}
18491849

1850+
// Auto set alpha band
1851+
for ( int bandNo = 1; bandNo <= mDataProvider->bandCount(); bandNo++ )
1852+
{
1853+
if ( mDataProvider->colorInterpretation( bandNo ) == QgsRasterDataProvider::AlphaBand )
1854+
{
1855+
if ( mPipe.renderer() )
1856+
{
1857+
mPipe.renderer()->setAlphaBand( bandNo );
1858+
}
1859+
break;
1860+
}
1861+
}
1862+
18501863
//resampler (must be after renderer)
18511864
QgsRasterResampleFilter * resampleFilter = new QgsRasterResampleFilter();
18521865
mPipe.set( resampleFilter );

0 commit comments

Comments
 (0)
Please sign in to comment.