[cairo] PNG and transparent background

Петрищенко Анатолий hsx at mail.ru
Sat Jan 29 11:54:29 PST 2011


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.
I've tried two ways to do that:
(Don't work obviously, because simply draws a transparent rectangle)
cairo_set_source_rgba(m_cr,1.0,1.0,1.0,0.0f);
cairo_rectangle(m_cr,0,0,size_x,size_y);       
cairo_fill(m_cr);
And other, that don't work either:
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?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110129/6bf99a4c/attachment.htm>


More information about the cairo mailing list