[Qgis-user] Transparent Shapeburst Fill

Nyall Dawson nyall.dawson at gmail.com
Mon Apr 6 02:17:04 PDT 2015


On 2 April 2015 at 19:43, Thomas Colley
<t.colley at neath-porttalbot.gov.uk> wrote:
> Hi
>
>
>
> Appearance of shapeburst fill seems strange when going to/from transparent.
>
>
>
> The linked image shows one shapeburst with a colour ramp White > Colour and
> another that goes Transparent > Colour. They’re both on a white background
> so my thinking is they should both look the same?

>
> I don’t know if this is down to a setting, or if there’s something that can
> be done with the blending modes (I’ve tried different modes but don’t have a
> good understanding).
>

Ready for your mind to be blown? Ok, here goes: not all transparent
colours are equal! Let me explain...

When QGIS interpolates between two colours it individually
interpolates each individual colour component (red, green and blue)
and the alpha channel separately. So, if the shapeburst colours are
RGB 0, 255, 0 and alpha 100% and RGB 255, 255, 255 and alpha 50% then
a colour 50% of the way will be 127, 255, 127 alpha 75%. Each RGB and
alpha channel have been individual interpolated.

Ok, so now let's set the second colour as transparent, with RGB 0,0,0
and alpha 0. Now, the colour 50% of the way will be 0, 125, 0 alpha
50% (dark green). What if instead the transparent colour had an RGB of
255, 255, 255, with alpha 0? Then the 50% colour will be 125, 255, 125
alpha 50% (light green). So even though both colours were totally
transparent, they still result in a different gradient.

So, in summary, try with your transparent colour having an RGB of 255,
255, 255 with alpha 0. This will look much different to a transparent
colour with RGB 0,0,0 alpha 0. For these kind of effects I usually
duplicate the main colour for the secondary and then drop its alpha to
0 - this keeps a constant colour with only the alpha channel varying.

Hope this helps!
Nyall



More information about the Qgis-user mailing list