[cairo] How to use a specified color as png transparent color?

Jerónimo Barraco Mármol jerobarraco at yahoo.com.ar
Thu Oct 27 05:51:04 PDT 2011

using a png with alpha channel will be the best suggestion.
but maybe you can import a png and use one of cairo painting operator to remove the color.. 
maybe, i dont know, is just and idea.
i think 1.10 has much more operators than that Jerónimo Barraco Mármol


De: Maarten Bosmans <mkbosmans at gmail.com>
Para: Carlo <defrag1986 at gmail.com>
CC: cairo at cairographics.org
Enviado: jueves, 27 de octubre de 2011 3:45
Asunto: Re: [cairo] How to use a specified color as png transparent color?

2011/10/26 Carlo <defrag1986 at gmail.com>:
> 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??

Adding a general remark to Bill's answer:

Cairo has no functions for import and export of images. The png
related functions are mainly for debugging purposes and intentionally
only handle a specific subset of PNG files.

Furthermore, Cairo is a vector graphics library, so doing
pixel-per-pixel operations on an image is not something we really have
good support for.

These two thing together mean that you are probably better of using
another program/library to edit the png files before you use them in

cairo mailing list
cairo at cairographics.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20111027/ce05a6e1/attachment.html>

More information about the cairo mailing list