[cairo] ps optimization

Adrian Johnson ajohnson at redneon.com
Mon Mar 10 07:40:48 PDT 2008

Charles Doutriaux wrote:
> I'd like to have the rectnalge drawn with rectangle but it comes from
> our "polyline" subroutine. I guess i could add a check in there to see
> if it is a rectangle.

The PDF rectangle optimization in cairo doesn't actually require
cairo_rectangle to be called. All it does is check if the path (in
device space) is equivalent to the PDF rectangle operator. ie the path
must be drawn as:

  cairo_move_to (cr, x, y);
  cairo_line_to (cr, x + w, y);
  cairo_line_to (cr, x + w, y + h);
  cairo_line_to (cr, x, y + h);
  cairo_close_path (cr);

The important part is that it is three lines followed by a close path
with the first and third line the horizontal lines. As your user space
is rotated 90 degrees the first third line would have to be vertical.

> I'd like for our users to switch to pdf as well... but it's heavilly
> used in our community... You know what they say about teaching new
> tricks to old dogs... Since we are on the subject. A big chunk of our
> users are usually using adobe illustrator to reload the ps files and
> merge them or rearrnge them later.

Can Illustrator import PDF files?

More information about the cairo mailing list