XImage *XCreateImage(display, visual, depth, format, offset, data, width, height, bitmap_pad,
      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;


display Specifies the connection to the X server.
visual Specifies the Visual structure.
depth Specifies the depth of the image.
format Specifies the format for the image. You can pass XYBitmap, XYPixmap, or ZPixmap.
offset Specifies the number of pixels to ignore at the beginning of the scanline.
data Specifies the image data.
width Specifies the width of the image, in pixels.
height Specifies the height of the image, in pixels.
bitmap_pad Specifies the quantum of a scanline (8, 16, or 32). In other words, the start of one scanline is separated in client memory from the start of the next scanline by an integer multiple of this many bits.
bytes_per_line Specifies the number of bytes in the client image between the start of one scanline and the start of the next.


The XCreateImage() function allocates the memory needed for an XImage structure for the specified display but does not allocate space for the image itself. Rather, it initializes the structure byte-order, bit-order, and bitmap-unit values from the display and returns a pointer to the XImage structure. The red, green, and blue mask values are defined for Z format images only and are derived from the Visual structure passed in. Other values also are passed in. The offset permits the rapid displaying of the image without requiring each scanline to be shifted into position. If you pass a zero value in bytes_per_line, Xlib assumes that the scanlines are contiguous in memory and calculates the value of bytes_per_line itself.

Note that when the image is created using XCreateImage(), XGetImage(), or XSubImage(), the destroy procedure that the XDestroyImage() function calls frees both the image structure and the data pointed to by the image structure.

See also

XAddPixel(), XDestroyImage(), XGetPixel(), XPutPixel(), XSubImage(), "Manipulating Images".
Christophe Tronche, [email protected]