Path Representation In Qahirah
Lawrence D'Oliveiro <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Organization | Geek Central |
| Message-ID | <[email protected]> |
It is handy to be able to perform manipulations on paths. In my Qahirah wrapper for Cairo <https://github.com/ldo/qahirah>, I originally stored a Path as a sequence of Elements--LineTo, MoveTo, CurveTo and Close objects, directly mapping to the obvious Cairo drawing calls. However, this representation makes it hard to do certain kinds of manipulations, such as constructing mesh patches following the shape of the path to produce a shadow effect. So I have changed the internal representation I use. This is now a sequence of Segments, each of which is a sequence of Points, together with an open/closed indication for the Segment. Each Point has a coordinate Vector, together with an on-curve/off-curve flag. Two successive on-curve points produce a straight line; a single off-curve point in-between defines a quadratic Bézier, while two off-curve points in-between make for a cubic Bézier. Each Segment must begin and end with an on-curve Point. I still support the Element representation, by providing conversions to/from the Segment representation, since Elements still provide the most natural mapping to the way paths are drawn in Cairo. -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo