12.07.2015 Views

Xlib − C Language X Interface

Xlib − C Language X Interface

Xlib − C Language X Interface

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Xlib</strong> − C LibraryX11, Release 6.7 DRAFTChapter 8Graphics FunctionsOnce you have established a connection to a display, you can use the <strong>Xlib</strong> graphics functions to:• Clear and copy areas• Draw points, lines, rectangles, and arcs• Fill areas• Manipulate fonts• Draw text• Transfer images between clients and the serverIf the same drawable and GC is used for each call, <strong>Xlib</strong> batches back-to-back calls to XDraw-Point, XDrawLine, XDrawRectangle, XFillArc, and XFillRectangle. Note that this reducesthe total number of requests sent to the server.8.1. Clearing Areas<strong>Xlib</strong> provides functions that you can use to clear an area or the entire window. Because pixmapsdo not have defined backgrounds, they cannot be filled by using the functions described in thissection. Instead, to accomplish an analogous operation on a pixmap, you should use XFillRectangle,which sets the pixmap to a known value.To clear a rectangular area of a given window, use XClearArea.XClearArea (display, w, x, y, width, height, exposures)Display *display;Window w;int x, y;unsigned int width, height;Bool exposures;displaywxywidthheightexposuresSpecifies the connection to the X server.Specifies the window.Specify the x and y coordinates, which are relative to the origin of the windowand specify the upper-left corner of the rectangle.Specify the width and height, which are the dimensions of the rectangle.Specifies a Boolean value that indicates if Expose events are to be generated.The XClearArea function paints a rectangular area in the specified window according to thespecified dimensions with the window’s background pixel or pixmap. The subwindow-modeeffectively is ClipByChildren. Ifwidth is zero, it is replaced with the current width of the windowminus x. If height is zero, it is replaced with the current height of the window minus y. If147

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!