[cairo] Applying to a surface the alpha of other

Carlos López González genetita at gmail.com
Tue Oct 16 09:43:40 PDT 2012


Hi,
unfortunately the proposed solution doesn't work. When a ARGB32 color
is painted in a RGB24 surface, the colors are multiplied by the alpha.
Say I have a ARGB color:
ARGB(0.8, 1.0, 0.5, 0.5)
once painted to a RGB24 surface it becomes:
RGB(0.8, 0.4, 0.4)

Later if I mask back this color thru a 0.6 alpha mask, then it keeps
the RGB values and keeps the alpha but the colors are washed out:

ARGB(0.6, 0.8, 0.4, 0.4)

When my desired result is
ARGB(0.6, 1.0, 0.5, 0.5) that is keep the colors of one surface and
apply the alpha of other.

Any other idea?


2012/10/16 Carlos López González <genetita at gmail.com>:
>>> Then basically the question is: How do I change the alpha channel of
>>> all the pixels to be 1.0?
>>
>> How about painting it to an RGB24 surface (with operator source)?
>>
>> Uli
>
> Ah great idea! I'll give it a try and let you know.
> Thanks!
> Cheers
>
> --
> Carlos
> http://synfig.org



-- 
Carlos
http://synfig.org


More information about the cairo mailing list