/* * Read a pixel from an X drawable. */ static unsigned long read_pixel( Display *dpy, Drawable d, int x, int y ) { XImage *pixel; unsigned long p; pixel = XGetImage( dpy, d, x, y, 1, 1, AllPlanes, ZPixmap ); if (pixel) { p = XGetPixel( pixel, 0, 0 ); XDestroyImage( pixel ); } else { p = 0; } return p; }