Bug report #7748
Transparent pixel list doesn't work if global transparency 0
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||16651|
The Transparent pixel list has no effect if the Global Transparency slider is set to 0. If you set the global transparency > 0 (eg 1%) then suddenly the Transparent Pixel List works as expected.
To test, load a raster with some large areas of consistent colour (eg white or black borders). Use the Add Values From Display button to make a colour transparent then click Apply. Nothing happens. Bump the Global Transparency to 1% and click Apply - the selected colour is now transparent.
Using version 1.9.0-Master from today 2/5/2013.
#4 Updated by Mathieu Pellerin - nIRV over 7 years ago
#5 Updated by Holger Eberhardt over 7 years ago
I can confirm this bug.
Example graphics can be downloaded here (Transparency_Bug.7z 34 MB).
In my case it's a png-File (RGB 16,7 million colours) with an external pyramids file (ERDAS). I want to hide the yellow (255,255,0) borders via custom transparency settings. But it only works when global transparency is set at least to 1%.
#6 Updated by Mathieu Pellerin - nIRV over 7 years ago
I've looked at the transparency values issue and believe the issue is with the bool fastDraw check (qgsmultibandcolorrenderer.cpp line 136), which seems to fail in checking for transparency list items. I unfortunately am not familiar with this code, nor the usesTransparency() function fastDraw relies on. Hope this can help you figure out what is wrong.
#7 Updated by Mathieu Pellerin - nIRV over 7 years ago
Ok, I think I got it.
usesTransparency (function defined qgsrasterrenderer.cpp line 86) checks whether there's a transparency value list via this bit of code: !mRasterTransparency->isEmpty()
isEmpty() (function defined qgsrastertransparency.cpp line 180) only checks for mTransparentSingleValuePixelList count, not mTransparentThreeValuePixelList. So transparency list defined for three value pixel will always return false. This means it fails to disable fastDraw unless some other raster modification is applied (global opacity, contrast, etc.)