GNOME Bugzilla – Bug 121603
arc is strange, undocumented, and shown with poor examples
Last modified: 2006-10-07 17:07:53 UTC
The arc drawing operation expects angles between 0 and 1 instead of degrees or grads (radians would be hell). The 0 is at 6 o'clock, though the comment in theme.c claims 12 o'clock. Neither the angle units nor the 0 angle is documented. The examples provided in theme-format.txt and the tutorial show angle values 30 and 180, which would imply degrees are expected. The counter-clockwise drawing direction should perhaps be documented, even though it's to be expected.
It's basically just XDrawArc() IIRC
Nah, that's the strange part. ;-) It does call gdk_draw_arc() which calls XDrawArc() and those have the same semantics, but the values from the theme aren't fed directly to the function. The offending code is in the function meta_draw_op_draw_with_env() in theme.c, lines 3285-3291: gdk_draw_arc (drawable, gc, op->data.arc.filled, rx, ry, rwidth, rheight, op->data.arc.start_angle * (360.0 * 64.0) - (90.0 * 64.0), /* start at 12 instead of 3 oclock */ op->data.arc.extent_angle * (360.0 * 64.0)); It's easy to fix, but I don't know what to fix it to. I'd need to know what the theme-writer's documentation should give as: 1) the 0 angle, 2) the drawing direction, and 3) the angle measurement.
Did anyone come up with any ideas as to what to fix it to? It looks like it would be quite easy to make optional attributes "start_degrees" and "extent_degrees" which could be used instead of "start_angle" and "extent_angle", if that's what people would prefer.
Fixed in HEAD!