[Qgis-developer] Symbol transparency, wrong value stored and displayed

Giuseppe Sucameli brush.tyler at gmail.com
Wed Aug 22 16:16:35 PDT 2012


Hi all,

I noticed that the alpha value stored in the QML for
QgsSimpleFillSymbolLayer objects is wrong.

Here's the QML generated when the symbol transparency is 70%:
<pre>
    <symbol outputUnit="MM" alpha="0.298039" type="fill" name="0">
      <layer pass="0" class="SimpleFill" locked="0">
        <prop k="color" v="255,128,0,76"/>
        <prop k="color_border" v="0,0,0,76"/>
        ...
      </layer>
    </symbol>
</pre>

The alpha value for the whole symbol is right (~0.30), instead the
layer's color alpha should be 255, not 76 (which is 0.30*255).

Old style files would be rendered using double transparency after
the fix, unless I convert style files using the
QgsProjectFileTransform::transform1800to1900() function like it's
done for project files, but anyway those ones created using QGis
master (before the fix) will still be affected and I guess this is
not avoidable.

I'm already on it :)

Furthermore, the alpha value of a symbol is not taken into account
while drawing its sub-symbols.
E.g. with a symbol fill (transparency 50%) -> line pattern fill ->
outline (transparency 0%) -> simple line I would suppose the
simple line should be semitransparent because child of the
semi-transparent symbol fill, but it's fully opaque.

Is it the supposed behavior?

Regards.

-- 
Giuseppe Sucameli


More information about the Qgis-developer mailing list