


IMXBM(3IM)             SDSC IMAGE LIBRARY              IMXBM(3IM)



NAME
     imxbm - X11 XBM file translation

SYNOPSIS
     #include <stdio.h>
     #include "sdsc.h"
     #include "im.h"

     int ImFileRead( fd, "xbm", flagsTable, dataTable )
          int         fd;
          TagTable   *flagsTable;
          TagTable   *dataTable;

     int ImFileFRead( fp, "xbm", flagsTable, dataTable )
          FILE         *fp;
          TagTable   *flagsTable;
          TagTable   *dataTable;

     int ImFileWrite( fd, "xbm", flagsTable, dataTable )
          int         fd;
          TagTable   *flagsTable;
          TagTable   *dataTable;

     int ImFileFWrite( fp, "xbm", flagsTable, dataTable )
          FILE         *fp;
          TagTable   *flagsTable;
          TagTable   *dataTable;


DESCRIPTION
     xbm bitmap image files are generated by MIT's X Window  Sys-
     tem,  version  11 (hereafter referred to as X11).  xbm files
     are generated by the X11 bitmap(1) bitmap editor and used by
     most  X11  tools  to  define cursors, icons, and other mono-
     chrome glyphs.  See the X11 documentation set for details on
     how to use tools and subroutines dealing with X11 bitmaps.

FILE RECOGNITION
     X11 xbm files are recognized by the following filename  suf-
     fixes:  .xbm and .bm.

NOTES
     SDSC image library support of the X11 xbm  format  does  not
     require use of any X11 libraries and contains no proprietary
     code.  X11 xbm format handling is available on  any  machine
     for which the SDSC image library is available.

     xbm files contain simple C code with two #define's  for  the
     width  and  height  of the image, two optional #define's for
     the X and Y location of the cursor hot spot, and one  static
     character array declaration and initialization for the image
     bits as follows:



SDSC              Last change: August 19, 1992                  1






IMXBM(3IM)             SDSC IMAGE LIBRARY              IMXBM(3IM)



          #define _n_a_m_e_width  _x_x_x
          #define _n_a_m_e_height _y_y_y
          #define _n_a_m_e_x_hot  _x_h_o_t
          #define _n_a_m_e_y_hot  _y_h_o_t
          static char _n_a_m_e__b_i_t_s[ ] = {
               ... _A_S_C_I_I _h_e_x _d_a_t_a ...
          };

     _x_x_x and _y_y_y define the width and height of the image  stored
     in the static character array.

     _x_h_o_t and _y_h_o_t define the hot spot location if the  image  is
     to be used as a cursor.

     The array is initialized with hex  byte  values,  with  each
     byte holding 8 1-bit pixel values.

  Reading X11 XBM files
     The SDSC image library reads X11 xbm bitmap glyphs and  maps
     them to IMVFBMONO VFBs without color lookup tables (CLTs).

     xbm hot spot locations, if present, are ignored.

  Writing X11 XBM files
     The SDSC image library writes IMVFBMONO VFBs as X11 xbm bit-
     map glyphs.

     Other image library VFB types  are  converted  to  IMVFBMONO
     VFBs  prior  to being written out.  See the ImFileWrite(3IM)
     man page for details.

     Image width and height #define's  are  based  on  the  VFB's
     width and height.

     _W_a_r_n_i_n_g:  The X11 bitmap editor bitmap(1)  was  designed  to
     edit  small  glyphs, like icons and cursors.  It tends to be
     have severe difficulty with large  bitmaps,  such  as  those
     that can be generated using the SDSC image library.

     Hot spot #define's are not output.

     The _n_a_m_e portion of the #define and static array  names  are
     determined as follows:

          If the filename tag is not present  in  the  flagsTable
          argument to ImFileWrite(3IM), _n_a_m_e defaults to stream.

          If the filename tag is present, the name is stripped of
          any  leading path (up to the last /).  Characters up to
          the first character not in the set 0-9a-zA-Z_ are  used
          to  construct  the  name.   If  the  first character is
          numeric, a leading x is prepended.  For example,



2                 Last change: August 19, 1992               SDSC






IMXBM(3IM)             SDSC IMAGE LIBRARY              IMXBM(3IM)



               flagsTable filename        Name replacement
               myfile.xbm                 myfile
               /this/that/the_other.xbm   the_other
               42.xbm                     x42
               blurt^&#$$.xbm             blurt

ERRORS
     In addition to those listed  for  ImFileRead(3IM),  X11  xbm
     file reading returns the following error codes:

          IMEMALLOC   Cannot allocate enough memory
          IMESYNTAX   Syntax error in parsing xbm file
          IMESYS      System call error in read operation

     In addition to those listed for  ImFileWrite(3IM),  X11  xbm
     file writing returns the following error codes:

          IMEMALLOC   Cannot allocate enough memory
          IMESYS      System call error in write operation

DOCUMENTATION
     bitmap(1) from the X11 man page set.

     _X_l_i_b - _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e, MIT X Window System,  Version
     11.

SEE ALSO
     ImIntro(3IM),   ImErrNo(3IM),   imconv(1IM),    imfile(1IM),
     imformats(1IM), imico(3IM), imicon(3IM), imxwd(3IM)

AUTHOR
     Dave Nadeau
     San Diego Supercomputer Center

CONTACT
     SDSC consultants, (619)534-5100, consult@y1.sdsc.edu



















SDSC              Last change: August 19, 1992                  3



