[cairo] cairo with gtk problem

Yogesh Arora yogesh.ar at gmail.com
Thu May 25 07:46:05 PDT 2006


hi

i tried using cairo with gtk using this code
                cairo_t* cr = gdk_cairo_create (window->gobj());

	cairo_pattern_t *pat = cairo_pattern_create_linear (0.0, 0.0,  0.0, 1.0);
	cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 1);
	cairo_pattern_add_color_stop_rgba (pat, 0, 1, 1, 1, 1);
	cairo_rectangle (cr, 0, 0, 1, 1);
	cairo_set_source (cr, pat);
	cairo_fill (cr);
	cairo_pattern_destroy (pat);

	pat = cairo_pattern_create_radial (0.45, 0.4, 0.1,
                                   0.4,  0.4, 0.5);
	cairo_pattern_add_color_stop_rgba (pat, 0, 1, 1, 1, 1);
	cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 1);
	cairo_set_source (cr, pat);
	cairo_arc (cr,(x+width)/2,(y+height)/2, width/2, 0, 2 * M_PI);
	cairo_fill (cr);
	cairo_pattern_destroy (pat);

i expect some gradients to be drawn(gradient.png) but a plain circle
was drawn on screen(untitled.jpg see the attachments)

can some one point the reason for this

-- 
Thanks
Yogesh

Dont be intimidated by impossibillity.... be motivated by possibillity!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: untitled.JPG
Type: image/jpeg
Size: 3466 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060525/e74743db/untitled-0001.jpe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gradient.png
Type: image/png
Size: 7856 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060525/e74743db/gradient-0001.png


More information about the cairo mailing list