[Cairo] Questions about enums in Cairo

Carl Worth cworth at east.isi.edu
Thu Nov 13 08:17:41 PST 2003


On Nov 12, Duncan Mak wrote:
 > LineCapSquare would probably maps to CAIRO_LINE_CAP_SQUARE and
 > LineCapRound to CAIRO_LINE_CAP_ROUND

Yes.

 > but what about the others and what
 > is the GDI+ equivalent of CAIRO_LINE_CAP_BUTT?

Not having looked at the GDI documentation, from the list above, it
looks like LineCapFlat -> CAIRO_LINE_CAP_BUTT.

For all the others, I don't think it should be too hard for you to
just let cairo stroke a butt-faced line, then draw the custom cap on
the end by creating a path and the calling cairo_fill.

Hmmm... But that may lead to seams between the stroke and the cap. A
better solution would be to call cairo_stroke_path, (once that
function gets implemented), then add your caps to the path, and draw
the entire shape with a single call to cairo_fill. Yes, much nicer.

You can use the first approach today to debug your custom cap drawing
code. Once that's working you can put pressure on me to implement
cairo_stroke_path, (or send a patch of course).

Let me know if you run into any problems.

 >         LineJoinMiterClipped - Specifies a mitered join. This produces a
 >         sharp corner or a beveled corner, depending on whether the
 >         length of the miter exceeds the miter limit [2].

That sounds like the cairo behavior for CAIRO_LINE_JOIN_MITER. I can't
imagine what LineJoinMiter might do since in the absence of clipping
miter lengths can become infinite. If infinite miters are what you
really want, you should be able to get as close as possible by
passing a very large value to cairo_set_miter_limit.

Hope that helps.

-Carl




More information about the cairo mailing list