|
gdk_draw_arc() draws an ellipse
or a portion of one. (Figure 20). The arc can be
filled or unfilled; the third argument to the function
toggles fill. The fourth through seventh arguments
describe a rectangle; the ellipse is inscribed in this
rectangle. angle1 is the
angle at which to start drawing; it is relative to the 3
o'clock position (that is, 0 radians). angle2 is the distance to travel
around the arc; if positive, travel is counterclockwise,
otherwise travel is clockwise. Both angle1 and
angle2 are specified in sixty-fourths of a degree;
so, 360 degrees is given as
360*64. This allows more precise specification of
the arc's size and shape, without using floating point
numbers. angle2 should
not exceed 360 degrees, since it is nonsensical to move
more than 360 degrees around the ellipse.
To draw a circle, draw from 0 to 360*64 inside a square:
gdk_draw_arc(drawable, gc, TRUE,
0, 0,
50, 50,
0, 360*64);
|
To draw half an ellipse, change the aspect ratio and
halve the span of the arc:
gdk_draw_arc(drawable, gc, TRUE,
0, 0,
100, 50,
0, 180*64);
|
Many X servers draw the edges of filled arcs in an
aesthetically unpleasing way; in particular, very small
circles may not look very circular. You can work around
this by also drawing the circle's outline.
|
|