28.2 A Bitmap Display Utility
The xshowbitmap program is a useful utility for reviewing a group of bitmap files. The filenames for the bitmaps can
be specified on the command line, sent through a pipe, or typed into stdin. All of the bitmaps are drawn into a
pixmap, which is rendered into a DrawingArea widget. The DrawingArea is used as the work window for a
ScrolledWindow, so that we can demonstrate application−defined scrolling for the Motif ScrolledWindow. The
bitmaps are displayed in an equal number of rows and columns if possible. Alternatively, you can specify either the
number of rows or the number of columns using the −rows or −columns command−line option, respectively.
The example in the source code demonstrates the use of Xt mechanisms for adding command−line options and
application−level resources in an application. For an explanation of these Xt features, see Volume Four, X Toolkit
Intrinsics Programming Manual. For details on the Xlib functions for reading and manipulating bitmaps, see
Volume One, Xlib Programming Manual. XtSetLanguageProc() is only available in X11R5; there is no
corresponding function in X11R4.
/* xshowbitmap.c −− displays a set of bitmaps specified on the command
* line, from a pipe, or typed into stdin. Bitmaps must be specified
* as file names.
*
* Usage: xshowbitmap
* −s sorts the bitmaps in order of size with largest first
* −v verbose mode for when input is redirected to stdin
* −w width of viewport window
* −h height of viewport window
* −fg foreground ...