home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!metrix!ama
- From: ama@metrix.UUCP (Alan Amaral)
- Newsgroups: comp.windows.x
- Subject: Re: Load pixmap into pixmap
- Message-ID: <890@metrix.UUCP>
- Date: 17 Nov 92 19:30:42 GMT
- References: <1992Nov7.142104.23123@alf.uib.no> <1992Nov16.184809.2642@lsl.co.uk>
- Reply-To: ama@metrix.UUCP (Alan Amaral)
- Organization: Metrix Network Systems Inc.
- Lines: 55
-
- In article <1992Nov16.184809.2642@lsl.co.uk> snail@lsl.co.uk writes:
- >In article <1992Nov7.142104.23123@alf.uib.no>, singg@alf.uib.no (Kurt George Gjerde) writes:
- >> I use the following code for loading a pixmap and drawing it inside
- >> another pixmap:
- >> Are there any faster ways to do this??
- >[deleted...]
- >> if (XGetGeometry(dpy,userpixmap, &d_root, &d_x, &d_y, &width,
- >> &height, &d_border_width, &d_depth)) {
- >>
- >> image = XGetImage(dpy, userpixmap, 0,0, width, height,
- >> 1, XYPixmap);
- >>
- >> XPutImage(dpy,win, gc,image,0,0,posX,
- >> posY,image->width, image->height);
- >> XPutImage(dpy,pixmap, gc,image,0,0,posX,
- >> posY,image->width, image->height);
- >
- >swap the second XPutImage with an XCopyArea from the 'win' to the 'pixmap'.
- >as follows:-
- > XCopyArea(dpy, win, pixmap, gc,
- > 0, 0, image->width, image->height,
- > PosX, PosY);
- >>
- >> XFree(image);
- >> }
- >--
-
- What you have suggested is NOT guaranteed to work, as the window may be
- unmapped, or partially or totally obscured, and backing store may not be
- available. Thus the copy that you get (if you get anything) in the pixmap
- may not be what you expect.
-
- Doing the XPutImage to the pixmap FIRST, and then copying from the pixmap to
- the window will work in any case...
-
- So, the code would look more like this:
-
- ...
-
- XPutImage(dpy,pixmap, gc,image,0,0,posX,
- posY,image->width, image->height);
-
- XCopyArea(dpy, pixmap, win, gc,
- 0, 0, image->width, image->height,
- PosX, PosY);
-
- ...
-
-
-
- Alan Amaral | Email: ama@metrix.COM
- Metrix Network Systems | Voice: (603) 888-7000
- --
- Alan Amaral | Email: ama@metrix.COM
- Metrix Network Systems | Voice: (603) 888-7000
-