[cairo] Is Cairo able to fit my needs?

Innova-Studios - Juergen Ladstaetter info at innova-studios.com
Wed Oct 3 13:01:32 PDT 2007


Hi there Carl and thanks for your reply!

Ad 2) doesn’t that function set the whole graphic to that color?
Ad 3) normally when painting two things over each other, a logical function
"COPY" is used. For displaying postscript there are also other functions
needed.
A small list of functions:
wxAND                 src AND dst
wxAND_INVERT          (NOT src) AND dst
wxAND_REVERSE         src AND (NOT dst)
wxCLEAR               0
wxCOPY                src
wxEQUIV               (NOT src) XOR dst
wxINVERT              NOT dst
wxNAND                (NOT src) OR (NOT dst)
wxNOR                 (NOT src) AND (NOT dst)
wxNO_OP               dst
wxOR                  src OR dst
wxOR_INVERT           (NOT src) OR dst
wxOR_REVERSE          src OR (NOT dst)
wxSET                 1
wxSRC_INVERT          NOT src
wxXOR                 src XOR dst

I will not use cairo to directly load postscript files, because I have to
manipulate them in my application.

Hope you know now what I mean :)
Kind regards, juergen


-----Ursprüngliche Nachricht-----
Von: Carl Worth [mailto:cworth at cworth.org] 
Gesendet: Mittwoch, 03. Oktober 2007 17:34
An: Innova-Studios - Juergen Ladstaetter
Cc: cairo at cairographics.org
Betreff: Re: [cairo] Is Cairo able to fit my needs?

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



More information about the cairo mailing list