XPutImage()XPutImage()NameXPutImage – 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
display Specifies a connection to an X server; returned from
XOpenDisplay().
d Specifies the drawable.
gc Specifies the graphics context.
image Specifies the image you want combined with the rectangle.
src_x Specify the coordinates of the upper-left corner of the rec‐
src_y tangle to be copied, relative to the origin of the image.
dest_x Specify the x and y coordinates, relative to the origin of
dest_y the drawable, where the upper-left corner of the copied rec‐
tangle will be placed.
width Specify the width and height in pixels of the rectangular
height area to be copied.
DescriptionXPutImage() 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-depen‐
dent components: foreground and background.
If an XYBitmap format is used, then the depth of image must be 1, oth‐
erwise 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
BadMatch See Description above.
BadValue
See AlsoXImageByteOrder(), XAddPixel(), XCreateImage(), XDestroyImage(), XGe‐
tImage(), XGetPixel(), XGetSubImage(), XPutPixel(), XSubImage().
Xlib - Images XPutImage()