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

Maarten Bosmans mkbosmans at gmail.com
Wed Oct 26 23:45:24 PDT 2011


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.

Maarten


More information about the cairo mailing list