[cairo] Color-Tinting a surface with alpha channel
Uli Schlachter
psychon at znc.in
Thu Dec 24 13:14:07 UTC 2020
Hi,
Am 22.12.20 um 07:18 schrieb Simon Schneegans:
[...]
> As Cairo.Operator.MULTIPLY uses normal OVER-alpha-blending, the
> code below does not really multiply the image with the given color. E.g.
> black semi-transparent areas will actually become tinted as well!
Could you explain a bit more what exactly you want to achieve? E.g.,
what should happen when tinting with r=0.5, g=1, b=0, a=0.5 to colors
such as full red and... basically all the other colors.
[...]> If anybody knows how to do a simple result.rgba = first.rgba *
> second.rgba in Cairo,
Do I understand correctly that you want to transform a given (r,g,b,a)
into (0.5*r, 1*g, 0*b, 0.5*a)? (numbers for my example above)
Is the alpha part really needed or could you live with no support for an
alpha component for the color "to tint with"?
Also, do you know the following page? It explains precisely what each of
the operators does.
https://www.cairographics.org/operators/
Cheers,
Uli
--
This can be a, a little complicated. Listen, my advice is... ask
somebody else for advice, at least someone who's... got more experience
at... giving advice.
More information about the cairo
mailing list