8.3 Drawing Points, Lines, Rectangles, and Arcs

Xlib provides functions that you can use to draw:

Some of the functions described in the following sections use these structures:


typedef struct {
	short x1, y1, x2, y2;
} XSegment;


typedef struct {
	short x, y;
} XPoint;


typedef struct {
	short x, y;
	unsigned short width, height;
} XRectangle;


typedef struct {
	short x, y;
	unsigned short width, height;
	short angle1, angle2;             /* Degrees * 64 */
} XArc;

All x and y members are signed integers. The width and height members are 16-bit unsigned integers. You should be careful not to generate coordinates and sizes out of the 16-bit ranges, because the protocol only has 16-bit fields for these values.

Next: Drawing Single and Multiple Points

Christophe Tronche, [email protected]