Re: CAIRO_FORMAT_A1 image source color

Uli Schlachter <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
On 29.03.2014 19:48, Uli Schlachter wrote:
[...]
> Anyway, attached is a quick example for this.
[...]

I hate it when this happens. Now with attachment and, just because I can, the
resulting PNG!

Uli
-- 
A learning experience is one of those things that say,
'You know that thing you just did? Don't do that.'
                     -- Douglas Adams

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
t.c (text/x-csrc, 672 B)
#include <cairo.h>
#include <pango/pangocairo.h>

static void draw(cairo_t *cr)
{
	PangoLayout *layout = pango_cairo_create_layout (cr);
	pango_layout_set_text (layout, "Hello World!", -1);
	pango_cairo_show_layout (cr, layout);
	g_object_unref (layout);
}

int main() {
	cairo_surface_t *s = cairo_image_surface_create (CAIRO_FORMAT_A1, 110, 30);
	cairo_t *cr = cairo_create (s);

	cairo_surface_destroy (s);

	cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
	cairo_set_source_rgba (cr, 1, 1, 1, 1);
	cairo_paint (cr);

	cairo_set_source_rgba (cr, 1, 1, 1, 0);
	draw (cr);

	cairo_surface_write_to_png (cairo_get_target(cr), "out.png");
	cairo_destroy (cr);
	return 0;
}
out.png (image/png, 279 B) - not displayed
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.