[cairo] Possible new function cairo_get_path_segment_count () ?
dagoldman at yahoo.com
Tue Aug 17 21:45:19 PDT 2010
Though only a newbie... May I be so bold as to propose a new function? It might
int cairo_get_path_segment_count (cairo_t *cr);
Or maybe some shorter name. It could return a long. I'll leave that decision to
the cairo experts.
I would propose the function return 0 (or maybe -1) for a new cr. After the
first cairo_move_to (), it would return 0. Each subsequent cairo_arc () or
cairo_line_to () would add 1 to the return value. Upon cairo_new_path (),
cairo_stroke () or cairo_fill (), the return value would go back to 0 (or maybe
-1). cairo_rectangle () on a new cr would result in a return value of 4.
Here are some reasons for adding the new function: *** I could currently make
use of it to help figure something out. *** It seems like generally useful
information, that some others might occasionally benefit from, and would
slightly improve the library. *** It's good for libraries to have functions that
return state information about objects. *** I already notice that some cairo
functions are not strictly unnecessary, but they are there for convenience. One
example is cairo_surface_show_page () and cairo_show_page () are intentionally
redundant. I could name a few others. **** It may be quite simple, perhaps even
trivial, to write. Perhaps the information is already stored somewhere.
Here are some reasons for NOT adding the function: *** I could also probably use
cairo_path_extents () to help figure out my little problem. *** The new function
may be quite difficult to write. *** I might be totally missing something, which
I'm sure someone would point out.
I would think an cairo_arc () would count as one segment. I vaguely remember
seeing a function that breaks an arc into multiple lines. I don't know whether
this would still be counted as one or many segments. My guess would be many
So, whaddya think? I am not volunteering to write the function. I looked at the
_cairo structure and don't have a clue how most of the members are used. If the
new function would be easy to write, I wish someone would do it. If it's a
booger to write, maybe just forget it. For the middle ground, I'll let the
powers that be decide.
More information about the cairo