[cairo] transparency with alpha channel RGBA
uray meiviar
uraymeiviar at yahoo.com
Thu Oct 29 00:14:20 PDT 2009
thank you for your reply,
currently I solved it by un-multiply the RGB value (divide RGB values by A) on fragment shader, which is no significant penalty since it was done on GPU, but now my concern is the wasted CPU cycle for RGB*A multiplication by Cairo (since CPU is far too slow compared to GPU), is there any switch to turn off premultiplied RGB process?
________________________________
From: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
To: uray meiviar <uraymeiviar at yahoo.com>
Cc: cairo at cairographics.org
Sent: Thu, October 29, 2009 4:00:01 AM
Subject: Re: [cairo] transparency with alpha channel RGBA
Hi,
On Tue, 27 Oct 2009, uray meiviar wrote:
> how do I get, non-premultiplied color so my openGL texture will have
> correct alpha channel values?
I believe you can use premultiplied textures with OpenGL by
configuring the right blend function. For the cases where using
unpremultiplied data is unavoidable you'll need to convert the
premultiplied data yourself before uploading the textures. Various
implementations of unpremultipliers are available here:
http://cgit.freedesktop.org/~joonas/unpremultiply/tree/
Generally the overhead from unpremultiplication is fairly low as long
as you don't implement it using three divisions per pixel.
Cheers,
Joonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20091029/0d4e2140/attachment.html
More information about the cairo
mailing list