home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / windows / x / 18937 < prev    next >
Encoding:
Text File  |  1992-11-09  |  1.2 KB  |  36 lines

  1. Newsgroups: comp.windows.x
  2. Path: sparky!uunet!utcsri!newsflash.concordia.ca!sifon!thunder.mcrcim.mcgill.edu!mouse
  3. From: mouse@thunder.mcrcim.mcgill.edu (der Mouse)
  4. Subject: Re: Copying pixmaps
  5. Message-ID: <1992Nov10.061048.4911@thunder.mcrcim.mcgill.edu>
  6. Organization: McGill Research Centre for Intelligent Machines
  7. References: <1992Nov7.142620.23268@alf.uib.no>
  8. Date: Tue, 10 Nov 92 06:10:48 GMT
  9. Lines: 26
  10.  
  11. In article <1992Nov7.142620.23268@alf.uib.no>, singg@alf.uib.no (Kurt George Gjerde) writes:
  12.  
  13. > I use the following code to copy a pixmap to another pixmap:
  14.  
  15. >              image  = XGetImage(dpy, pixmap, 0,0, width,
  16. >                                 height, 1, XYPixmap);
  17.  
  18. >              XPutImage(dpy,pixmap2, gc, image, 0,0,0,0,
  19. >                        image->width, image->height);
  20.  
  21. >              XFree(image);
  22.  
  23. > Are there any faster ways of doing this??
  24.  
  25. Almost certainly.  If the pixmaps are the same depth, XCopyArea is
  26. almost certain to be far faster, especially since XYPixmap is usually
  27. not the "native" format and thus has to be converted to and from, which
  28. will cost.
  29.  
  30. Besides that, XFree is not the right thing to use to free up the XImage
  31. returned by XGetImage.  You should use XDestroyImage.
  32.  
  33.                     der Mouse
  34.  
  35.                 mouse@larry.mcrcim.mcgill.edu
  36.