[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

XGetImage problem



Hi,

According to Matt Chapman,
> Status update/notes:

> XGetImage (used for desktop saves) fails when that part of the window
> is outside the boundaries of the screen. Does anyone have ideas
> on how to get around this?

I got the same problem. Here is, I hope, a way to resolve it :

void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy)
{
  /*
    XImage *image;

    offset *= BYTESPERPIXEL;
    image = XGetImage(display, wnd, x, y, cx, cy, AllPlanes, ZPixmap);
    cache_put_desktop(offset, cx, cy, image->bytes_per_line,
image->bytes_per_line/cx, image->data);
    XDestroyImage(image);
  */

  Pixmap pix;
  XImage *image;

  pix = XCreatePixmap (display, wnd, cx, cy, DefaultDepth (display,
DefaultScreen (display)));
  XCopyArea (display, wnd, pix, gc, x, y, cx, cy, 0, 0);

  offset *= BYTESPERPIXEL;
  image = XGetImage(display, pix, 0, 0, cx, cy, AllPlanes, ZPixmap);
  cache_put_desktop(offset, cx, cy, image->bytes_per_line,
image->bytes_per_line/cx, image->data);
  XDestroyImage(image);
  XFreePixmap (display, pix);
}


-- 
Philippe MARTIN
ERIDAN Informatique
http://www.eridan-info.fr