Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!olivea!mintaka!bloom-beacon!LARRY.MCRCIM.MCGILL.EDU!mouse From: mouse@LARRY.MCRCIM.MCGILL.EDU Newsgroups: comp.windows.x Subject: Re: Help with Ximages and/or pixmaps Message-ID: <9010120307.AA07107@Larry.McRCIM.McGill.EDU> Date: 12 Oct 90 03:07:20 GMT Sender: root@athena.mit.edu (Wizard A. Root) Organization: The Internet Lines: 37 > Question: I am working with XView 2.0 and have had a lot of success > so far. I am now at the point where I need to display 2D 8 bit > images in windows. I need different sized images and sometimes I > need several dozen small (40x40) images on the screen. I have the > raw data in arrays of unsigned char image[][]; > Do i use pixmaps or do I use XImages? How do I use them? I > understand some of the differences but I'd like to know the pros and > cons of both. You almost certainly[%] want to use XImages at some point. Whether to use Pixmaps or not is a question of tradeoffs - typically, trading off server memory against redisplay speed. As an outline, you can either create an XImage and then XPutImage it to the window, or you can create an XImage, XPutImage it to a Pixmap, and then XCopyArea that pixmap to the window. The advantage of the latter is that you need do the XPutImage only once; after that you can copy from the Pixmap as often as you like, and it will happen very fast (compared to the XPutImage). This makes handling damage to the window easy: just have the Expose events trigger calls to XCopyArea. The disadvantage is that it costs server memory to store the Pixmap. If server memory is scarce (on an X terminal, for example), this may not be a good idea. [%] `"almost" certainly' because it *is* possible to draw a picture by breaking it up into primitives such as rectangles, lines, pixels, etc, and drawing them. For most pictures, this is much, much slower. (If the picture is geometrically simple, such as a few rectangles of uniform colors, this may not be true. In any case, trying to make the decision automatically at run-time is not simple without some sort of information about the picture's contents.) der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu