Re: How to use a specified color as png transparent color?

Bill Spitzak <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
First off you might want to see if you can create your png files with 
actual transparency, which will allow antialiasing and will otherwise 
work much nicer and easier.

I think the way to do it is to read the png file into your own 4-channel 
buffer, then search that buffer and change all matching colors to 0, and 
(possibly) change the alpha of all non-matching colors to 0xFF. You can 
then tell Cairo to use this buffer as an image source, telling it that 
it is RGBA.

It looks like trying to modify the Cairo image created from reading the 
png may not work, as it will be marked as being a 3-channel image and 
thus the alpha will be ignored (somebody correct me if wrong!)

Carlo wrote:
> Hi. I would  import a png and copy it on a surface with the "target 
> color" used as transparent color.
> I'm working with different set of png, each set has a background color 
> that I don't want to show.
> How can I make this??
> 
> Thank you for help
> Carlo Ferraresi
> -- 
> cairo mailing list
> [email protected]
> http://lists.cairographics.org/mailman/listinfo/cairo
--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.