NAME
XPutImage − draw an image on a window or pixmap.
Synopsis
XPutImage(display, d, gc, image, src_x, src_y,
dest_x, dest_y, width, height)
Display *display;
Drawable d;
GC gc;
XImage *image;
int src_x, src_y;
int dest_x, dest_y;
unsigned int width, height;
Arguments
displaySpecifies a connection to an X server; returned from XOpenDisplay().
dSpecifies the drawable.
gcSpecifies the graphics context.
imageSpecifies the image you want combined with the rectangle.
src_x
src_ySpecify the coordinates of the upper-left corner of the rectangle to be copied, relative to the origin of the image.
dest_x
dest_ySpecify the x and y coordinates, relative to the origin of the drawable, where the upper-left corner of the copied rectangle will be placed.
width
heightSpecify the width and height in pixels of the rectangular area to be copied.
Description
XPutImage() draws a section of an image on a rectangle in a window or pixmap. The section of the image is defined by src_x, src_y, width and height. There is no limit to the size of image that can be sent to the server using XPutImage(). XPutImage() automatically decomposes the call into multiple protocol requests to make sure that the maximum request size of the server is not exceeded. XPutImage() uses these graphics context components: function, plane_mask, subwindow_mode, clip_x_origin, clip_y_origin, and clip_mask. This function also uses these graphics context mode-dependent components: foreground and background. If an XYBitmap format image is used, then the depth of d must be 1, otherwise a BadMatch error is generated. The foreground pixel in gc defines the source for bits set to one in the image, and the background pixel defines the source for the bits set to zero. For XYPixmap and ZPixmap format images, the depth of the image must match the depth of drawable or a BadMatch error results.
Structures
typedef struct _XImage {
int width, height;/* size of image */
int xoffset;/* number of pixels offset in x direction */
int format;/* XYBitmap, XYPixmap, ZPixmap */
char *data;/* pointer to image data */
int byte_order;/* data byte order, LSBFirst, MSBFirst */
int bitmap_unit;/* quant. of scan line 8, 16, 32 */
int bitmap_bit_order;/* LSBFirst, MSBFirst */
int bitmap_pad;/* 8, 16, 32 either XY or ZPixmap */
int depth;/* depth of image */
int bytes_per_line;/* accelerator to next line */
int bits_per_pixel;/* bits per pixel (ZPixmap) */
char *obdata;/* hook for the object routines to hang on */
struct funcs {/* image manipulation routines */
struct _XImage *(*create_image)();
int (*destroy_image)();
unsigned long (*get_pixel)();
int (*put_pixel)();
struct _XImage *(*sub_image)();
int (*add_pixel)();
} f;
} XImage;
Errors
BadDrawable
BadGC
BadMatchSee Description above.
BadValue
See Also
ImageByteOrder(), XAddPixel(), XCreateImage(), XDestroyImage(), XGetImage(), XGetPixel(), XGetSubImage(), XPutPixel(), XSubImage().
Copyright O’Reilly & Assoc. —