[comp.windows.x] Pixmap vs. Image

chucko@ucscc.UCSC.EDU (30502000) (06/02/90)

Summary:
To use Pixmap or Image structures when pixel computations
are performed often.

I am in the design stage of an X application that involves
quite a bit of image manipulation.  Images come to me as 16-bit,
and will usually be treated as 8-bit by my application.  I need
to keep around the 16-bit data in case I need to get to the
real (unquantized) data.  In order to "blend" or "overlay" 2 or
more images and display them in an 8-bit deep window I need to
do computations on corresponding pixels in each image to create
the blended image (the computation is similar to finding the pixel
value when using XStandardColormaps).

My understanding, so far, is that images (Ximage structure) reside
on the client and shipping them to my window can take lots of time
(many <<dozens of?>> seconds) for large images.  Pixmaps, however,
reside on the workstation (server) and can be loaded into the
window much faster.  Here's the question:

If I have to do these computations (an add and multiply) on each pixel,
and load the result into a window.  First, where do the computations
take place (server or client)?  Second, if they take place on the
client, is it faster to use Images which are already there, or use
Pixmaps which seems to imply a round trip for each pixel?  Which is
faster, which is easier, which is politically correct????

Your help is much appreciated.

Reply to the newsgroup if you think it's of interest to others,
otherwise direct and perhaps I'll summarize.

Chuck Stein                         chucko@ucscc.ucsc.edu
Mirror Imaging / NOARL West

{ I do represent the opinion of my employer. }

jimf@SABER.COM (06/03/90)

|My understanding, so far, is that images (Ximage structure) reside
|on the client and shipping them to my window can take lots of time
|(many <<dozens of?>> seconds) for large images.  Pixmaps, however,
|reside on the workstation (server) and can be loaded into the
|window much faster.  Here's the question:
|
|If I have to do these computations (an add and multiply) on each pixel,
|and load the result into a window.  First, where do the computations
|take place (server or client)?  Second, if they take place on the
|client, is it faster to use Images which are already there, or use
|Pixmaps which seems to imply a round trip for each pixel?  Which is
|faster, which is easier, which is politically correct????

If you're doing heavy image manipulation, do it in the client and ship
a finished XImage to the server.  This is much faster than doing
per-pixel manipulations (which are still done on the client but which
will be sent one-at-a time to the server).

I suggest, however, sending the image to a pixmap and using the pixmap
to blit to the window.  This means you only send the processed image
once, although it can potentially use a lot of memory in the server.

I don't know why it's taking so long to send an XImage to your server;
in practice I can send large 8-bit images over the network in a couple
of seconds, and even faster locally.

I suggest looking at the code to xloadimage, which does a variety of
simple image processing functions.

jim frost
saber software
jimf@saber.com