XDrawRectangle(3X) XDrawRectangle(3X)NAME XDrawRectangle, XDrawRectangles - draw rectangles and manipulate the XRectangle structure SYNOPSIS XDrawRectangle (display, d, gc, x, y, width, height) Display *display; Drawable d; GC gc; int x,y; unsigned int width, height; XDrawRectangles (display, d, gc, rectangles, nrectangles) Display *display; Drawable d; GC gc; XRectangle rectangles[]; int nrectangles; DESCRIPTION The XDrawRectangle and XDrawRectangles functions draw the outlines of the specified rectangle or rectangles as if a five-point polyline were specified for each rectangle: [x,y,] [x+width,y] [x+width,y+height] [x,y+height] [x,y] For the specified rectangle or rectangles, these functions do not draw a pixel more than once. XDrawRectangles draws the rectangles in the order listed in the array. If rectan- gles intersect, the intersecting pixels are drawn multiple times. Both functions use these graphic context components: func- tion, plane-mask, line-width, line-style, join-style, fill- style, subwindow-mode, clip-x-origin, clip-y-origin, and clip-mask. They also use these mode-dependent graphic con- text components: foreground, background, tile, stipple, tile-stipple-x-origin, tile-stipple-y-origin, dash-offset, and dash-list. Structures The XRectangle structure is defined as follows. typedef struct { short x, y; unsigned short width, height; } XRectangle; All x and y members are signed integers. The width and height members are 16-bit unsigned integers. You should be November, 1990 1
XDrawRectangle(3X) XDrawRectangle(3X)careful not to generate coordinates and sizes out of the 16-bit ranges, because the protocol only has 16-bit fields for these values. Arguments These functions accept the following arguments: d Specifies the drawable. display Specifies the connection to the X server. gc Specifies the graphic context. nrectangles Specifies the number of rectangles in the array. rectangles Specifies a pointer to an array of rectangles. width, height Specify the width and height that define the outline of the rectangle. x, y Specify the x and y coordinates that define the upper-left corner of the rectangle. ERRORS BadDrawable A value for a Drawable argument does not name a de- fined window or pixel map. BadGC A value for a GC argument does not name a defined graphic context. BadMatch An InputOnly window is used as a Drawable; or, an argument or pair of arguments has the correct type and range but fails to match in some other required way. The XDrawRectangle and XDrawRectangles functions can gen- erate BadDrawable, BadGC, and BadMatch errors. SEE ALSO XCreateGC(3X), XDrawArc(3X), XDrawLine(3X), XDrawPoint(3X)Xlib - C Language Interface2 November, 1990