<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:'lucida console', sans-serif;font-size:8pt"><div>thank you for your reply,</div><div><br></div><div>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?</div><div style="font-family:lucida console, sans-serif;font-size:8pt"><br><div style="font-family:arial, helvetica, sans-serif;font-size:8pt"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> M Joonas Pihlaja <jpihlaja@cc.helsinki.fi><br><b><span style="font-weight: bold;">To:</span></b> uray meiviar <uraymeiviar@yahoo.com><br><b><span style="font-weight:
bold;">Cc:</span></b> cairo@cairographics.org<br><b><span style="font-weight: bold;">Sent:</span></b> Thu, October 29, 2009 4:00:01 AM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [cairo] transparency with alpha channel RGBA<br></font><br>
<br>Hi,<br><br>On Tue, 27 Oct 2009, uray meiviar wrote:<br><br>> how do I get, non-premultiplied color so my openGL texture will have <br>> correct alpha channel values?<br><br>I believe you can use premultiplied textures with OpenGL by <br>configuring the right blend function. For the cases where using <br>unpremultiplied data is unavoidable you'll need to convert the <br>premultiplied data yourself before uploading the textures. Various <br>implementations of unpremultipliers are available here:<br><br><span><a target="_blank" href="http://cgit.freedesktop.org/~joonas/unpremultiply/tree/">http://cgit.freedesktop.org/~joonas/unpremultiply/tree/</a></span><br><br>Generally the overhead from unpremultiplication is fairly low as long <br>as you don't implement it using three divisions per pixel.<br><br>Cheers,<br><br>Joonas<br></div></div><div style="position:fixed"></div></div><br>
</body></html>