home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / windows / x / 19254 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  2.4 KB

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