void putximage(XImage *img, int src_x, int src_y, int dst_x, int dst_y,
int width, int height)
{
XPutImage(xv.d, xv.pmap, xv.gc, img, src_x, src_y, dst_x, dst_y,
width, height);
}
unsigned long pgetximage(XImage *img, int x, int y)
{
void *p = img->data + y * img->bytes_per_line;
if (xv.depth == 24)
return *((unsigned long *)p + x);
else
return *((unsigned short *)p + x);
}
void psetximage(XImage *img, int x, int y, unsigned long pixel)
{
void *p = img->data + y * img->bytes_per_line;
if (xv.depth == 24)
*((unsigned long *)p + x) = pixel;
else
*((unsigned short *)p + x) = pixel;
}