XDraw
Syntax
#include <X11/X10.h>
Status XDraw(display, d, gc, vlist, vcount)
Display *display;
Drawable d;
GC gc;
Vertex *vlist;
int vcount;
Arguments
display
| Specifies the connection to the X server.
|
d
| Specifies the drawable.
|
gc
| Specifies the GC.
|
vlist
| Specifies a pointer to the list of vertices that indicate what to draw.
|
vcount
| Specifies how many vertices are in vlist.
|
Description
The
XDraw()
function 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 in the
vertex structure.
Each Vertex, as defined in
X11/X10.h,
is a structure with the following members:
typedef struct _Vertex {
short x,y;
unsigned short flags;
} Vertex;
The x and y members are the coordinates of the vertex
that are relative to either the upper-left inside corner of the drawable
(if
VertexRelative
is zero) or the previous vertex (if
VertexRelative
is one).
The flags, as defined in
X11/X10.h ,
are as follows:
VertexRelative 0x0001 /* else absolute */
VertexDontDraw 0x0002 /* else draw */
VertexCurved 0x0004 /* else straight */
VertexStartClosed 0x0008 /* else not */
VertexEndClosed 0x0010 /* else not */
-
If
VertexRelative
is not set,
the coordinates are absolute (that is, relative to the drawable's origin).
The first vertex must be an absolute vertex.
-
If
VertexDontDraw
is one,
no line or curve is drawn from the previous vertex to this one.
This is analogous to picking up the pen and moving to another place
before drawing another line.
-
If
VertexCurved
is one,
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 one only if a previous and next vertex are both defined
(either explicitly in the array or through the definition of a closed
curve).
-
It is permissible for
VertexDontDraw
bits and
VertexCurved
bits both to be one.
This is useful if you want to define the previous point for the smooth curve
but do not want an actual curve drawing to start until this point.
-
If
VertexStartClosed
is one,
then this point marks the beginning of a closed curve.
This vertex must be followed later in the array by another vertex
whose effective coordinates are identical
and that has a
VertexEndClosed
bit of one.
The points in between form a cycle to determine predecessor
and successor vertices for the spline algorithm.
This function uses these GC 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.
It also uses these GC mode-dependent components:
foreground, background, tile, stipple,
tile-stipple-x-origin, tile-stipple-y-origin, dash-offset, and dash-list.
See also
XDrawFilled(),
"Compatibility Functions".
Christophe Tronche, ch@tronche.com