Re: writting out a pixmap file

Steve Lamont (spl@szechuan.ucsd.edu)
Wed, 12 Mar 97 10:34:09 PST

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> what would be the best way to do this ? I have a created pixmap and need
> to generate a file that I can then print, I can't find anyting mt X books
> nor in the manual

By pixmap do you mean an Xpm pixmap or an actual X Pixmap?

The Xpm pixmap is just a collection of character strings. You can
write them out directly with a loop of fprintf()s. There are also Xpm
library functions which allow some data manipulation. Refer to the
Xpm documentation which comes along with the distribution for details.

You can convert the Xpm data to some other format with an external
tool kit such as NETPBM or sxpm (which comes as part of Xpm).
The FAQ document which comes with the Xpm distribution discusses this.

Alternatively, you can interpret the Xpm character strings for
yourself. Again, refer to the Xpm documentation will give you
guidance on how to do this.

Check either

ftp.x.org (18.112.44.100) contrib (Boston, USA)
koala.inria.fr (138.96.24.30) pub/xpm (Sophia Antipolis, France)

for the current release of Xpm and its docs.

If you mean a real, honest to goodness X Pixmap, then things may be a
bit more involved. You need to read the Pixmap from the X server with
XGetImage().

If the Pixmap is from a TrueColor Visual then all you have to do is
write the data out in your favorite format.

If the Pixmap is from a PseudoColor visual, then you have to remap the
pixels from server Colormap space to RGB space. To do this, you'll
have to get the lookup table from the Colormap using XQueryColors()
and do a table lookup.

Refer to your favorite Xlib manual set for the details.

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/xforms-archive/