[cairo] PNG and transparent background

Uli Schlachter psychon at znc.in
Sat Jan 29 13:18:57 PST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Am 29.01.2011 20:54, Петрищенко Анатолий wrote:
> 
> Hello,
> I have a very simple problem. I'm using cairo to draw some text and save it to png format file,using cairo_surface_write_to_png. But, I can't make background transparent. I  think, I simply don't get an idea of doing that.
[...]
> cairo_save(m_cr);
> 	cairo_set_operator(m_cr,CAIRO_OPERATOR_SOURCE);
> 	cairo_set_source_rgba(m_cr,1.0,1.0,1.0,0.0);
> 	cairo_paint(m_cr);
> 	cairo_restore(m_cr);
> In all cases, all I've got is a white opaque background. What can be used to perform this trick?

Hi,

no idea what you might be doing wrong, but attached is a small app which
generates a file "out.png" with a transparent background using the operations
you gave above.

I hope this helps you figuring your problem out.

Cheers,
Uli
- -- 
"Do you know that books smell like nutmeg or some spice from a foreign land?"
                                                  -- Faber in Fahrenheit 451
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBCAAGBQJNRIQ+AAoJECLkKOvLj8sGe+cH/2N04fEN5IrrJ8y1UbPT/Hw4
aMC6/UFzDR7tc88KM+Ze+1zZdppAbDZwVkNH3nq1AfbOFXNTRosGADZNkQeK2fLW
17CMqQ5pgwvmxCRji6LvzlAy0xfpQipmRB2G775fVp/gc5HqUqwGR7Q+9c7Rwtr6
XM7Trtn3aDyb1ql+QfADvJtAjNBMBUVEx1JpY1UBd2dPprPDsxXNOjo5S++M1ZR0
0HaOixjBv/fNs1Nok1KszJIxzy7w3Bz6i9UJi8Ve7+/1RlUQb0RWk9RUZ7DJF6e/
GzhUQ/XXFUe+6HKtHvG7sWg1eqdCsEMA68c3D+RGGHu5VE3OrZvcsDMdIAyHwAc=
=115i
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.c
Type: text/x-csrc
Size: 513 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110129/6b570af2/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.c.sig
Type: application/octet-stream
Size: 287 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110129/6b570af2/attachment.obj>


More information about the cairo mailing list