Path: utzoo!attcan!uunet!cs.utexas.edu!husc6!bloom-beacon!EXPO.LCS.MIT.EDU!rws From: rws@EXPO.LCS.MIT.EDU Newsgroups: comp.windows.x Subject: Re: XImage problems Message-ID: <8908221220.AA05842@expire.lcs.mit.edu> Date: 22 Aug 89 12:20:04 GMT References: <1628@lamont.ldgo.columbia.edu> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 42 On a Sun 4/280 w/32 Mb of memory running SunOS 4.0.1, MIT X11/R3, a 512x512 image requires between 5 and 10 minutes to load. Yup. We've sped up the common cases of XGetPixel and XPutPixel considerably for R4. I don't have real numbers handy, but xwud can remap an 1152x900x8-bit image in about 34 seconds on a Sun 3/60, doing an XGetPixel and an XPutPixel and a little bit of computation for each element. Not blindingly fast, but better. (Compare that with your time, which is for an image roughly 4 times smaller, on a machine roughly three times faster.) I thought of keeping an array of 256 GC's (one for each pixel value) and then doing XDrawPoint()s with the appropriate GC, but this seems kind of ugly. I hope you're joking. I've also thought of bypassing XPutPixel() by directly writing pixel data into the XImage->data memory, You can certainly do this. but, besides this being incredibly unportable, It isn't really, not if you know what the image format is. The data representation is really set by the protocol, not by Xlib. Could someone explain the difference between XYPixmap and ZPixmap format, and how I can address individual pixels or bits thereof in an 8-bit image? (My guess is you don't really want to deal with XYPixmap.) Try reading Section 8 of the protocol document (page 357 in the Digital Press book). ZPixmap is really pretty straightforward for 8-bit images. I'd also like to know just how much data space I need to allocate for a width*height 8-bit XImage. It depends on what the scanline pad is (8, 16, or 32). The total size is (ROUNDUP(width * bits_per_pixel, scanline_pad) >> 3) * height.