Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ XDrawArcs(3x) — HP-UX 9.05

Media Vault

Software Library

Restoration Projects

Artifacts Sought

 

NAME

XDrawArcs − draw multiple arcs. 

Synopsis

XDrawArcs(display, drawable, gc, arcs, narcs)
Display *display;
Drawable drawable;
GC gc;
XArc *arcs;
int narcs;

Arguments

displaySpecifies a connection to an X server; returned from XOpenDisplay(). 

drawableSpecifies the drawable. 

gcSpecifies the graphics context. 

arcsSpecifies a pointer to an array of arcs. 

narcsSpecifies 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 3 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 coincides with the last point in the last arc, the two arcs will join correctly.  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 counterclockwise 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 circle 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 Also

XClearArea(), XClearWindow(), XCopyArea(), XCopyPlane(), XDraw, XDrawArc(), XDrawFilled(), XDrawLine(), XDrawLines(), XDrawPoint(), XDrawPoints(), XDrawRectangle(), XDrawRectangles(), XDrawSegments(), XFillArc(), XFillArcs(), XFillPolygon(), XFillRectangle(), XFillRectangles(). 

Copyright O’Reilly & Assoc.  —  

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026