[cairo] Re-working cairo_current_path
Kristian Høgsberg
krh at bitplanet.net
Mon Jan 24 11:23:43 PST 2005
Keith Packard wrote:
> Around 13 o'clock on Jan 24, =?UTF-8?B?S3Jpc3RpYW4gSMO4Z3NiZXJn?= wrote:
>
>
>>Ah, right, take the length out of the cairo_path_element_t and keep
>>knowledge of element size inside cairo. Yeah, that's better and makes
>>it possible to adjust the path representation later on if necessary.
>
>
> If we need to change the path representation, we can create a new
> function that returns the new type. As long as this datatype is allocated
> explicitly for the clients use and isn't simply returned as a pointer to
> the internal state of the path, I don't see the benefit in making the
> contents opaque. It's not like applications are going to magically be
> able to deal with a new component of the path...
Using an iterator and an opaque data type would make it feasible to
actually use the cairo intenal representation for iterating the path:
cairo_walk_path (cr, &iter);
while (cairo_path_iter_next (&iter, &elt) {
switch (elt->type) {
case CAIRO_PATH_ELEMENT_MOVE_TO:
...
}
}
cairo_path_iter_fini (&iter);
... or something.
Kristian
More information about the cairo
mailing list