[cairo] Buffering features

Ian Britten britten at caris.com
Thu Aug 12 05:08:03 PDT 2010

Hi all,
I've got an existing workflow that predates our move to Cairo, and
I'm wondering if Cairo (Or any of the graphics gurus here) might
have any suggestions to improve/simplify it.
[ NB - Still using Cairo 1.8.x ]

Get a vector path of a rendered feature (or group of features, or a
complicated feature like text), which includes an additional buffer
around the rendered data.  The result will typically be a polygon
(or collection of), possibly with holes.

We currently have a rendering system that draws the data, and I can
easily get it to render to a Cairo 1-bit surface instead.  However,
in order to add the buffer around the feature, we have to intercept
all the drawing instructions, and increase the pen thickness before
the data is drawn.  Text is even hairier.  This is ugly and

Finally, we have to convert the 1-bit bitmap back to vector.  We
have code to do this, but it's sub-optimal.  I know Cairo has some
facility to do this some (eg: cairo_glyph_path()), and would
happily eliminate our code, if a better solution was available.

So, can anyone suggest a simpler/cleaner approach?  Any tricks or 
techniques that might make this easier?  Or should I just stick
with what we currently have?
Many thanks for any suggestions!

More information about the cairo mailing list