XDraw()XDraw()NameXDraw – draw a polyline or curve between vertex list (from X10).
Synopsis
Status XDraw(display, drawable, gc, vlist, vcount)
Display *display;
Drawable drawable;
GC gc;
Vertex *vlist;
int vcount;
Arguments
display Specifies a connection to an X server; returned from
XOpenDisplay().
drawable Specifies the drawable.
gc Specifies the graphics context.
vlist Specifies a pointer to the list of vertices that indicates
what to draw.
vcount Specifies how many vertices are in vlist.
Returns
Zero on failure, non-zero on success.
Description
This function is provided for compatibility with X Version 10. To use
it you must include the file <X11/X10.h> and link with the library
-loldX. Its performance is likely to be low.
XDraw draws an arbitrary polygon or curve. The figure drawn is defined
by the specified list of vertices (vlist). The points are connected by
lines as specified in the flags member of each of the Vertex struc‐
tures.
The Vertex structure contains an x,y coordinate and a bitmask called
flags that specifies the drawing parameters.
The x and y elements of Vertex are the coordinates of the vertex that
are relative to either the previous vertex (if VertexRelative is 1) or
the upper-left inside corner of the drawable (if VertexRelative is 0).
If VertexRelative is 0 the coordinates are said to be absolute. The
first vertex must be an absolute vertex.
If the VertexDontDraw bit is 1, no line or curve is drawn from the pre‐
vious vertex to this one. This is analogous to picking up the pen and
moving to another place before drawing another line.
If the VertexCurved bit is 1, a spline algorithm is used to draw a
smooth curve from the previous vertex, through this one, to the next
vertex. Otherwise, a straight line is drawn from the previous vertex
to this one. It makes sense to set VertexCurved to 1 only if a previ‐
ous and next vertex are both defined (either explicitly in the array,
or through the definition of a closed curve - see below).
It is permissible for VertexDontDraw bits and VertexCurved bits to both
be 1. This is useful if you want to define the previous point for the
smooth curve, but you do not want an actual curve drawing to start
until this point.
If VertexStartClosed bit is 1, then this point marks the beginning of a
closed curve. This vertex must be followed later in the array by
another vertex whose absolute coordinates are identical and which has
VertexEndClosed bit of 1. The points in between form a cycle for the
purpose of determining predecessor and successor vertices for the
spline algorithm.
XDraw achieves the effects of the X10 XDraw, XDrawDashed, and XDrawPat‐
terned functions.
XDraw uses the following 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.
A Status of zero is returned on failure, and non-zero on success.
For more information, see Volume One, Appendix B, X10 Compatibility.
Structures
typedef struct _Vertex {
short x,y;
unsigned short flags;
} Vertex;
/* defined constants for use as flags */
#define VertexRelative 0x0001 /* else absolute */
#define VertexDontDraw 0x0002 /* else draw */
#define VertexCurved 0x0004 /* else straight */
#define VertexStartClosed 0x0008 /* else not */
#define VertexEndClosed 0x0010 /* else not */
See AlsoXClearArea(), XClearWindow(), XCopyArea(), XCopyPlane(), XDrawArc(),
XDrawArcs(), XDrawFilled(), XDrawLine(), XDrawLines(), XDrawPoint(),
XDrawPoints(), XDrawRectangle(), XDrawRectangles(), XDrawSegments(),
XFillArc(), XFillArcs(), XFillPolygon(), XFillRectangle(), XFillRectan‐
gles().
Xlib - Drawing Primitives XDraw()