[cairo] Using patterns from Illustrator EPS library files

James Cloos cloos at jhcloos.com
Fri Feb 27 07:31:41 PST 2009


I took a look at one of those files.

You'll want to use the ai8 versions rather than the cs2 versions, as
they are closer the Postscript.  (I suspect the cs2 versions have a pdf
in the commment at their end.)

The ai8 versions can be split.  Grab each section from a
%AI8_BeginBrushPattern comment to a %AI8_EndBrushPattern comment into a
file.  The next line after the BeginBrushPattern is a string which names
that pattern.

Later in the file are similar sections between %AI8_BeginPluginObject
and %AI8_EndPluginObject.  Each of these references a BrushPattern by
name.  Those have the real names you want.

The enxt step is to convert to cairo calls.  It shouldn't be very
difficult to write a parser for the simplified code in these
BrushPattern and PluginObject sections.  Eg, m is for moveto, l for
lineto, c for curveto, etc.  And they translate well into cairo's API.

I'm not aware of anything already written, but it shouldn't be very
difficult to write, and the translation can be to any cairo API (C, C++,
perl, python, ruby, nickle, etc) which you need or prefer.

-JimC
-- 
James Cloos <cloos at jhcloos.com>         OpenPGP: 1024D/ED7DAEA6


More information about the cairo mailing list