home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / fbm / src / fbm.h < prev    next >
C/C++ Source or Header  |  1990-06-24  |  4KB  |  124 lines

  1. /*****************************************************************
  2.  * fbm.h: FBM Release 1.0 25-Feb-90 Michael Mauldin
  3.  *
  4.  * Copyright (C) 1989,1990 by Michael Mauldin.  Permission is granted
  5.  * to use this file in whole or in part for any purpose, educational,
  6.  * recreational or commercial, provided that this copyright notice
  7.  * is retained unchanged.  This software is available to all free of
  8.  * charge by anonymous FTP and in the UUNET archives.
  9.  *
  10.  * fbm.h: Fuzzy Bitmap Definition
  11.  *
  12.  * USAGE
  13.  *    # include <fbm.h>
  14.  *
  15.  * EDITLOG
  16.  *    LastEditDate = Mon Jun 25 00:03:05 1990 - Michael Mauldin
  17.  *    LastFileName = /usr2/mlm/src/misc/fbm/fbm.h
  18.  *
  19.  * HISTORY
  20.  * 25-Jun-90  Michael Mauldin (mlm@cs.cmu.edu) Carnegie Mellon
  21.  *    Package for Release 1.0
  22.  *
  23.  * 07-Mar-89  Michael Mauldin (mlm) at Carnegie Mellon University
  24.  *    Beta release (version 0.9) mlm@cs.cmu.edu.
  25.  *
  26.  * 20-Aug-88  Michael Mauldin (mlm) at Carnegie-Mellon University
  27.  *    Created.
  28.  *****************************************************************/
  29.  
  30. # define FBM_MAX_TITLE        80        /* For title and credits */
  31.  
  32. # define BLACK            0        /* For 8bit files */
  33. # define WHITE            255        /* For 8bit files */
  34. # define BYTE            256        /* For 8bit files */
  35.  
  36. # define BIG            1        /* msb first byte order */
  37. # define LITTLE            0        /* lsb first byte order */
  38.  
  39. # define BYTESPERLINE        32        /* For PostScript output */
  40.  
  41. # define BLANKS        "                                             "
  42. # define SKIPARG    while (*++(*argv)); --(*argv)
  43. # define CLRARG        strncpy (*argv, BLANKS, strlen (*argv)); \
  44.             while (*++(*argv)); --(*argv)
  45.  
  46. # define FMT_ATK    1    /*   Andrew toolkit raster format */
  47. # define FMT_FACE    2    /*   Bennet Yee's 1bit Face format */
  48. # define FMT_FBM    3    /* + Fuzzy bitmap format */
  49. # define FMT_GIF    4    /*   Compuserve Graphics Interchange */
  50. # define FMT_IFF    5    /*   Amiga Interchange Format File */
  51. # define FMT_LEAF    6    /*   InterLeaf image format */
  52. # define FMT_MCP    7    /*   Macpaint format */
  53. # define FMT_PBM    8    /*   Poskanzer 1bit format */
  54. # define FMT_PCX    9    /*   PCX format */
  55. # define FMT_SUN    10    /* + Sun rasterfile */
  56. # define FMT_TIFF    11    /*   Tagged IFF, Next, Macintosh */
  57. # define FMT_X11    12    /*   X11 format */
  58. # define FMT_RLE    13    /*   Utah RLE format */
  59.  
  60. # define FMTCHAR ".ABFGILMPZSTXR"
  61.  
  62. # define DEF_8BIT    FMT_FBM
  63. # define DEF_1BIT    FMT_SUN
  64.  
  65. /* An FBM bitmap header in memory */
  66. typedef struct fbm_hdr_struct {
  67.     int    cols;            /* Width in pixels */
  68.     int    rows;            /* Height in pixels */
  69.     int    planes;            /* Depth (1 for B+W, 3 for RGB) */
  70.     int    bits;            /* Bits per pixel */
  71.     int    physbits;        /* Bits to store each pixel */
  72.     int    rowlen;            /* Length of a row in bytes */
  73.     int    plnlen;            /* Length of a plane in bytes */
  74.     int    clrlen;            /* Length of color map */
  75.     double    aspect;            /* ratio of Y to X of one pixel */
  76.     char    title[FBM_MAX_TITLE];    /* Null terminated title */
  77.     char    credits[FBM_MAX_TITLE];    /* Null terminated credits */
  78. } FBMHDR;
  79.  
  80. # define FBM_MAGIC    "%bitmap"
  81. # define BM_MAGIC    ('!' << 8 | '!')
  82. # define PCX_MAGIC    0xa
  83. # define GIF_MAGIC    "GIF87a"
  84. # define IFF_MAGIC    "FORM"
  85. # define SUN_MAGIC    0x59a66a95
  86.  
  87. /* FBM bitmap headers in files (null terminated 12 character ascii strings) */
  88. typedef struct fbm_filehdr_struct {
  89.     char    magic[8];        /* 2 bytes FBM_MAGIC number */
  90.     char    cols[8];        /* Width in pixels */
  91.     char    rows[8];        /* Height in pixels */
  92.     char    planes[8];        /* Depth (1 for B+W, 3 for RGB) */
  93.     char    bits[8];        /* Bits per pixel */
  94.     char    physbits[8];        /* Bits to store each pixel */
  95.     char    rowlen[12];        /* Length of a row in bytes */
  96.     char    plnlen[12];        /* Length of a plane in bytes */
  97.     char    clrlen[12];        /* Length of colormap in bytes */
  98.     char    aspect[12];        /* ratio of Y to X of one pixel */
  99.     char    title[FBM_MAX_TITLE];    /* Null terminated title */
  100.     char    credits[FBM_MAX_TITLE];    /* Null terminated credits */
  101. } FBMFILEHDR;
  102.  
  103. /* An FBM bitmap in memory */
  104. typedef struct fbm_struct {
  105.     FBMHDR hdr;            /* Bitmap header */
  106.     unsigned char *cm;        /* Pointer to colormap */
  107.     unsigned char *bm;        /* Pointer to raw bits */
  108. } FBM;
  109.  
  110. /* Functions */
  111. double atof ();
  112. char *strcpy();
  113. char *strncpy();
  114.  
  115. #ifndef _COMPAT_
  116. char *malloc();
  117. #endif
  118.  
  119. long time (), get_long ();
  120. int get_short ();
  121.  
  122. /* Macro for getting next magic char */
  123. # define NEXTMCH(F,S,L) (((L) > 0) ? ((L)--, *(S)++) : getc (F))
  124.