[cairo] Is Cairo able to fit my needs?

Carl Worth cworth at cworth.org
Wed Oct 3 08:34:18 PDT 2007


On Wed, 3 Oct 2007 12:44:00 +0200, "Innova-Studios - Juergen Ladstaetter" wrote:
> 1) drawing polygons with N points

That's quite simple:

	cairo_move_to (cr, poly[0].x, poly[0].y);
	for (i = 1; i < poly_points; i++)
		cairo_line_to (cr, poly[i].x, poly[i].y);

Or the idiom that I prefer that takes advantage of an initial
cairo_line_to devolving into a cairo_move_to, and that will handle a
polygon with no points:

	cairo_new_sub_path (cr);
	for (i = 0; i < poly_points; i++)
		cairo_line_to (cr, poly[i].x, poly[i].y);

> 2) filling of those polygons (specific color)

After the above, do:

	/* Each value here is within [0.0 : 1.0] */
	cairo_set_source_rgba (cr, red, green, blue, alpha);

	cairo_fill (cr);

> 3) using logical functions how the polygon is mapped over the existing
> graphic

For this part I'm not sure what you're asking. Can you give a more
specific example?

> Without the last part it isn’t possible to display chained AI, EPS, PS
> objects so here is my question: does cairo fit my needs and if so, could you
> give me the function names so that I can read about it in the docs section?

Cairo should be able to handle anything in PostScript quite well and
also quite directly, (since PostScript was the inspiration for most
cairo interfaces). Do let us know if you find something missing.

And have fun with cairo!

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20071003/bd9b3dbb/attachment.pgp 


More information about the cairo mailing list