NAME
XCreateImage − allocate memory for an XImage structure.
Synopsis
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;
Arguments
displaySpecifies a connection to an X server; returned from XOpenDisplay().
visualSpecifies a pointer to a visual that should match the visual of the window the image is to be displayed in.
depthSpecifies the depth of the image.
formatSpecifies the format for the image. Pass one of these constants: XYBitmap, XYPixmap, or ZPixmap.
offsetSpecifies the number of pixels beyond the beginning of the data (pointed to by data) where the image actually begins. This is useful if the image is not aligned on an even addressable boundary.
dataSpecifies a pointer to the image data.
width
heightSpecify the width and height in pixels of the image.
bitmap_pad
Specifies the quantum of a scan line. In other words, the start of one scan line is separated in client memory from the start of the next scan line by an integer multiple of this many bits. You must pass one of these values: 8, 16, or 32.
bytes_per_line
Specifies the number of bytes in the client image between the start of one scan line and the start of the next. If you pass a value of 0 here, Xlib assumes that the scan lines are contiguous in memory and thus calculates the value of bytes_per_line itself.
Description
XCreateImage() allocates the memory needed for an XImage structure for the specified display and visual. This function does not allocate space for the image itself. It initializes the structure with byte order, bit order, and bitmap unit values, and returns a pointer to the XImage structure. The red, green, and blue mask values are defined for ZPixmap format images only and are derived from the Visual structure passed in. Note that when the image is created using XCreateImage(), XGetImage(), or XSubImage(), the destroy procedure that XDestroyImage() calls frees both the image structure and the data pointed to by the image structure. For a description of images, see Volume One, Chapter 6, Drawing Graphics and Text.
See Also
ImageByteOrder(), XAddPixel(), XDestroyImage(), XGetImage(), XGetPixel(), XGetSubImage(), XPutImage(), XPutPixel(), XSubImage().
Copyright O’Reilly & Assoc. —