12.07.2015 Views

Xlib − C Language X Interface

Xlib − C Language X Interface

Xlib − C Language X Interface

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Xlib</strong> − C LibraryX11, Release 6.7 DRAFTgetting and putting images are XGetImage and XPutImage.Note that no functions have been defined, as yet, to read and write images to and from disk files.The XImage structure describes an image as it exists in the client’s memory. The user canrequest that some of the members such as height, width, and xoffset be changed when the imageis sent to the server. Note that bytes_per_line in concert with offset can be used to extract a subsetof the image. Other members (for example, byte order, bitmap_unit, and so forth) are characteristicsof both the image and the server. Ifthese members differ between the image and theserver, XPutImage makes the appropriate conversions. The first byte of the first line of plane nmust be located at the address (data + (n * height * bytes_per_line)). For adescription of theXImage structure, see section 8.7.To allocate an XImage structure and initialize it with image format values from a display, useXCreateImage.XImage *XCreateImage(display, visual, depth, format, offset, data, width, height, bitmap_pad,bytes_per_line)Display *display;Visual *visual;unsigned int depth;int format;int offset;char *data;unsigned int width;unsigned int height;int bitmap_pad;int bytes_per_line;displayvisualdepthformatoffsetdatawidthheightbitmap_padSpecifies the connection to the X server.Specifies the Visual structure.Specifies the depth of the image.Specifies the format for the image. Youcan pass XYBitmap, XYPixmap, orZPixmap.Specifies the number of pixels to ignore at the beginning of the scanline.Specifies the image data.Specifies the width of the image, in pixels.Specifies the height of the image, in pixels.Specifies the quantum of a scanline (8, 16, or 32). In other words, the start of onescanline is separated in client memory from the start of the next scanline by aninteger multiple of this many bits.bytes_per_line Specifies the number of bytes in the client image between the start of one scanlineand the start of the next.The XCreateImage function allocates the memory needed for an XImage structure for the specifieddisplay but does not allocate space for the image itself. Rather, itinitializes the structurebyte-order, bit-order, and bitmap-unit values from the display and returns a pointer to the XImagestructure. The red, green, and blue mask values are defined for Z format images only and arederived from the Visual structure passed in. Other values also are passed in. The offset permits416

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

Saved successfully!

Ooh no, something went wrong!