[comp.windows.x] Imaging in X/XView

denault@hale.ifa.hawaii.edu (Tony Denault) (07/27/90)

I'm writing an application to display images in XView. I need some
advice on speeding up the display.  My images can vary in size, 
up to 256x256.  When reading in an image, I allocate long ints (32 bits)
to hold the data.  My program will need to zoom on images, redefine 
the scaling, and change the color map, etc...

Currently my program calculates the color for each pixel and 
does an XFillRectangle(). This is the easiest and probably 
slowest way. 

I considered using a pixmap. Hoping that I could work on the display
internally, then copy the result to a canvas. But to draw on a pixmap
requires using XFillRectangle() and the memory used for the pixmap
is on the server, so I see no gain in performance.

I think the way to go is using an XImage structure. If I define an
XImage to be the same size and depth of my canvas window. I should
be able to build an image and use XPutImage to dump the data into
my drawable. Hopefully this is fast. Since the memory for XImage is
allocated on the client side, I can fill color values using memset()
rather that lots of X messages to the server. 

I am correct in my thinking.  Any suggestion & Advice is appreciated.

Thanks

Tony D.

--
/------------------------------------------------------------------------\
| Tony Denault, Institute for Astronomy,  |  denault@hale.ifa.hawaii.edu |
| 2680 Woodlawn Drive, Honolulu, HI 96789 |               (808) 956-6097 |
\------------------------------------------------------------------------/