home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / fj / maillis / xwindow / 17632 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  2.7 KB

  1. Path: sparky!uunet!stanford.edu!sun-barr!sh.wide!wnoc-tyo-news!scslwide!wsgw!wsservra!daemon
  2. From: metrix!ama@bloom-beacon.MIT.EDU (Alan Amaral)
  3. Newsgroups: fj.mail-lists.x-window
  4. Subject: Re: Load pixmap into pixmap
  5. Message-ID: <1992Nov19.044238.28637@sm.sony.co.jp>
  6. Date: 19 Nov 92 04:42:38 GMT
  7. Sender: daemon@sm.sony.co.jp (The devil himself)
  8. Distribution: fj
  9. Organization: Metrix Network Systems Inc.
  10. Lines: 61
  11. Approved: michael@sm.sony.co.jp
  12.  
  13. Date: 17 Nov 92 19:30:42 GMT
  14. Message-Id: <890@metrix.UUCP>
  15. Newsgroups: comp.windows.x
  16. References: <1992Nov7.142104.23123@alf.uib.no>, <1992Nov16.184809.2642@lsl.co.uk>
  17. Sender: xpert-request@expo.lcs.mit.edu
  18.  
  19. In article <1992Nov16.184809.2642@lsl.co.uk> snail@lsl.co.uk writes:
  20. >In article <1992Nov7.142104.23123@alf.uib.no>, singg@alf.uib.no (Kurt George Gjerde) writes:
  21. >> I use the following code for loading a pixmap and drawing it inside
  22. >> another pixmap:
  23. >> Are there any faster ways to do this?? 
  24. >[deleted...]
  25. >>                 if (XGetGeometry(dpy,userpixmap, &d_root, &d_x, &d_y, &width,
  26. >>                              &height, &d_border_width, &d_depth)) {
  27. >> 
  28. >>                    image  = XGetImage(dpy, userpixmap, 0,0, width, height,
  29. >>                                        1, XYPixmap);
  30. >> 
  31. >>                    XPutImage(dpy,win, gc,image,0,0,posX,
  32. >>                              posY,image->width, image->height);
  33. >>                    XPutImage(dpy,pixmap, gc,image,0,0,posX,
  34. >>                              posY,image->width, image->height);
  35. >
  36. >swap the second XPutImage with an XCopyArea from the 'win' to the 'pixmap'.
  37. >as follows:-
  38. >                     XCopyArea(dpy, win, pixmap, gc,
  39. >                               0, 0, image->width, image->height,
  40. >                               PosX, PosY);
  41. >> 
  42. >>                    XFree(image);
  43. >>                 }
  44. >-- 
  45.  
  46. What you have suggested is NOT guaranteed to work, as the window may be
  47. unmapped, or partially or totally obscured, and backing store may not be
  48. available.  Thus the copy that you get (if you get anything) in the pixmap
  49. may not be what you expect.
  50.  
  51. Doing the XPutImage to the pixmap FIRST, and then copying from the pixmap to
  52. the window will work in any case...
  53.  
  54. So, the code would look more like this:
  55.  
  56.                 ...
  57.  
  58.                    XPutImage(dpy,pixmap, gc,image,0,0,posX,
  59.                              posY,image->width, image->height);
  60.  
  61.                    XCopyArea(dpy, pixmap, win, gc,
  62.                              0, 0, image->width, image->height,
  63.                              PosX, PosY);
  64.  
  65.                 ...
  66.  
  67.  
  68.  
  69. Alan Amaral             |  Email: ama@metrix.COM
  70. Metrix Network Systems  |  Voice: (603) 888-7000
  71. -- 
  72. Alan Amaral             |  Email: ama@metrix.COM
  73. Metrix Network Systems  |  Voice: (603) 888-7000
  74.