XDrawArcs()XDrawArcs()NameXDrawArcs – draw multiple arcs.
Synopsis
XDrawArcs(display, drawable, gc, arcs, narcs)
Display *display;
Drawable drawable;
GC gc;
XArc *arcs;
int narcs;
Arguments
display Specifies a connection to an X server; returned from
XOpenDisplay().
drawable Specifies the drawable.
gc Specifies the graphics context.
arcs Specifies a pointer to an array of arcs.
narcs Specifies the number of arcs in the array.
Description
This is the plural version of XDrawArc(). See XDrawArc() for details
of drawing a single arc.
There is a limit to the number of arcs that can be drawn in a single
call. It varies according to the server. To determine how many arcs
you can draw in a single call, find out your server's maximum request
size using XMaxRequestSize(). Subtract three and divide by three: this
is the maximum number of arcs you can draw in a single XDrawArcs()
call.
The arcs are drawn in the order listed in the arcs array.
By specifying one axis to be zero, a horizontal or vertical line can be
drawn. Angles are computed based solely on the coordinate system,
ignoring the aspect ratio.
For any given arc, no pixel is drawn more than once. If the last point
in one arc coincides with the first point in the following arc, the two
arcs will join correctly. If the first point in the first arc coin‐
cides with the last point in the last arc, the two arcs will join cor‐
rectly. If two arcs join correctly and if line_width is greater than 0
and the arcs intersect, no pixel is drawn more than once. Otherwise,
the intersecting pixels of intersecting arcs are drawn multiple times.
Specifying an arc with one endpoint and a clockwise extent draws the
same pixels as specifying the other endpoint and an equivalent counter‐
clockwise extent, except as it affects joins.
XDrawArcs() uses these graphics context components: function,
plane_mask, line_width, line_style, cap_style, join_style, fill_style,
subwindow_ mode, clip_x_origin, clip_y_origin, and clip_mask. This
function also uses these graphics context mode-dependent components:
foreground, background, tile, stipple, ts_x_origin, ts_y_origin,
dash_offset, and dashes.
The following is a technical explanation of the points drawn by
XDrawArcs(). For an arc specified as [x, y, width, height, angle1,
angle2], the origin of the major and minor axes is at [x+(width/2),
y+(height/2)], and the infinitely thin path describing the entire cir‐
cle or ellipse intersects the horizontal axis at [x,y+(height/2)] and
[x+width, y+(height/2)] and intersects the vertical axis at
[x+(width/2),y] and [x+(width/2), y+height]. These coordinates can be
fractional. That is, they are not truncated to discrete coordinates.
The path should be defined by the ideal mathematical path. For a wide
line with line width line_width, the bounding outlines for filling are
given by the infinitely thin paths describing the arcs:
[x+dx/2, y+dy/2, width-dx, height-dy, angle1, angle2]
and:
[x-line_width/2, y-line_width/2, width+line_width, height+line_width,
angle1, angle2]
where:
dx=min(line_width,width)
dy=min(line_width,height)
If (height != width) the angles must be specified in the effectively
skewed coordinate system of the ellipse (for a circle, the angles and
coordinate systems are identical). The relationship between these
angles and angles expressed in the normal coordinate system of the
screen (as measured with a protractor) is as follows:
skewed-angle = atan(tan(normal-angle) * width/height) + adjust
The skewed-angle and normal-angle are expressed in radians (rather than
in 64ths of a degree) in the range [0,2*PI], and where atan returns a
value in the range [-PI/2,PI/2], and where adjust is:
0 for normal-angle in the range [0,PI/2]
PI for normal-angle in the range [PI/2,(3*PI)/2]
2*PI for normal-angle in the range [(3*PI)/2,2*PI]
For more information, see Volume One, Chapter 6, Drawing Graphics and
Text.
Structures
typedef struct {
short x, y;
unsigned short width, height;
short angle1, angle2; /* Start and end of arc, in */
/* 64ths of degrees */
} XArc;
Errors
BadDrawable
BadGC
BadMatch
See AlsoXClearArea(), XClearWindow(), XCopyArea(), XCopyPlane(), XDraw,
XDrawArc(), XDrawFilled(), XDrawLine(), XDrawLines(), XDrawPoint(),
XDrawPoints(), XDrawRectangle(), XDrawRectangles(), XDrawSegments(),
XFillArc(), XFillArcs(), XFillPolygon(), XFillRectangle(), XFillRectan‐
gles().
Xlib - Drawing Primitives XDrawArcs()