home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!stanford.edu!sun-barr!sh.wide!wnoc-tyo-news!scslwide!wsgw!wsservra!daemon
- From: metrix!ama@bloom-beacon.MIT.EDU (Alan Amaral)
- Newsgroups: fj.mail-lists.x-window
- Subject: Re: Load pixmap into pixmap
- Message-ID: <1992Nov19.044238.28637@sm.sony.co.jp>
- Date: 19 Nov 92 04:42:38 GMT
- Sender: daemon@sm.sony.co.jp (The devil himself)
- Distribution: fj
- Organization: Metrix Network Systems Inc.
- Lines: 61
- Approved: michael@sm.sony.co.jp
-
- Date: 17 Nov 92 19:30:42 GMT
- Message-Id: <890@metrix.UUCP>
- Newsgroups: comp.windows.x
- References: <1992Nov7.142104.23123@alf.uib.no>, <1992Nov16.184809.2642@lsl.co.uk>
- Sender: xpert-request@expo.lcs.mit.edu
-
- 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
-