Path: utzoo!attcan!uunet!decwrl!ucbvax!bloom-beacon!ncd.COM!lemke From: lemke@ncd.COM (Dave Lemke) Newsgroups: comp.windows.x Subject: Re: XCopyPlane() bug (sort of). Message-ID: <9007101642.AA12606@hansen.com> Date: 10 Jul 90 16:42:53 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 57 From: uunet!ucbvax.berkeley.edu!pasteur!graft!scott (Scott Silvey) Date: 9 Jul 90 22:13:49 GMT I am trying to turn a window's image into an X11 bitmap. I want to write thi s bitmap out to a file using XWriteBitmapFile(). However, I can't find any way to do this using XCopyPlanes or XGet/PutImage i f the window is on a color display (multiple planes). There is apparently no way for me to copy the information from the window to a single plane bitmap short of checking each and every pixel one at a time. Here are the two methods I've tried: 1) [XCopyPlane()] The Xlib manual says that XCopyPlane() doesn't care if the depth of it's two drawables is different, however, when I try the following line, XCopyPlane() generates a BadMatch error (Invalid parameter attribues) : XCopyPlane(display, window, /* 8 bits deep */ bitmap, /* 1 bit deep */ gc, /* GC with function GXor */ 0, 0, width, height, 0, 0, /* width, height == 300 */ plane_mask); /* only 1 bit set */ is the GC's depth the same as the destination bitmap's? (it inherits the depth from the drawable used when its created. this requirement is stated under XCreateGC(), possibly not the most obvious place.) 2) [XGetImage() / XPutImage()] For XGetImage() on the type XYPixmap, the Xli b manual says that the depth of the returned image is equal to the number of planes requested in the plane mask. So, I tried to use XGetImage() and XPutImage() with type XYPixmap, but this also generates a BadMatch error: image = XGetImage(display, window, /* 8 bits deep */ 0, 0, width, height, /* width, height == 300 */ plane_mask, /* 1 bit set */ XYPixmap); XPutImage(display, bitmap, /* 1 bit deep */ gc, /* GC with function GXor */ image, /* image from XGetImage */ 0, 0, 0, 0, width, height); /* width, height == 300 */ probably the GC's depth again. Dave Lemke ARPA: lemke@ncd.com Network Computing Devices, Inc. UUCP: {uunet,ardent,mips}!lupine!lemke