home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / software / unix / saoimage / sao1_07.tar / hfiles / color.h < prev    next >
C/C++ Source or Header  |  1992-10-09  |  6KB  |  159 lines

  1. #ifndef lint
  2. static char SccsColorId[] = "%W%  %G%";
  3. #endif
  4.  
  5. /* Module:    Color.h
  6.  * Purpose:    Define the structs for color control parameters and some
  7.  *        related constants
  8.  * Modified:    {0} Michael VanHilst    initial version           9 May 1989
  9.  *        {1} Valdes  increased PSEUDOZ to 256           9 Oct 1992
  10.  *        {n} <who> -- <does what> -- <when>
  11.  */
  12.  
  13. #define UNKNOWN 0
  14. #define CAN     1
  15. #define CANNOT  2
  16. #define MAY     0
  17. #define MUST    8
  18. #define MAYNOT 16
  19.  
  20. #define COLMAPSZ 256        /* maximum number of color cells */
  21. #define PSEUDOSZ 256        /* maximum number of table vertices */
  22.  
  23. struct palletteRec {        /* widely used read-only color pixels */
  24.   int std_black;        /* from BlackPixel */
  25.   int std_white;        /* from WhitePixel */
  26.   int true_black;        /* true 0,0,0 black */
  27.   int true_white;        /* true max,max,max white */
  28.   int red;
  29.   int green;
  30.   int blue;
  31.   int yellow;
  32. };
  33.  
  34. struct colmapRec {
  35.   int private_used;        /* flag using private colormap */
  36.   int private_installed;    /* flag private map is installed */
  37.   int default_permit;        /* user permission to use default map */
  38.   int default_enable;        /* confirmed ability to use default map */
  39.   int private_permit;        /* user permission to use private map */
  40.   int private_enable;        /* confirmed ability to use private map */
  41.   Colormap default_colormap;    /* default colormap of root */
  42.   Colormap private_colormap;    /* private created colormap */
  43.   XVisualInfo *default_vinfo;    /* info about the default visual */
  44.   XVisualInfo *private_vinfo;    /* info about a private visual */
  45. };
  46.  
  47. struct cellspecRec {
  48.   int overlay;            /* request for overlay plane */
  49.   int wanted;            /* desired (maximum) number of cells */
  50.   int min;            /* minimum acceptable number of cells */
  51.   int got;            /* actual number of cells reserved */
  52. };
  53.  
  54. typedef struct _GCspec {
  55.   unsigned long foreground;
  56.   unsigned long background;
  57.   int func;
  58.   unsigned long mask;
  59. } GCspec;
  60.  
  61. struct gcsetRec {
  62.   GCspec disp;            /* image display parameters */
  63.   GCspec draw;            /* cursor drawing parameters */
  64.   GCspec track;            /* cursor tracking parameters */
  65.   GCspec undraw;        /* cursor erasing parameters */
  66.   GCspec incl;            /* include region parameters */
  67.   GCspec excl;            /* exclude region parameters */
  68.   GCspec menu;            /* stc_black on std_white */
  69.   GCspec red;            /* for drawing red lines */
  70.   GCspec green;            /* for drawing green lines */
  71.   GCspec blue;            /* for drawing blue lines */
  72.   GCspec black;            /* for drawing black lines */
  73.   GCspec white;            /* for drawing white lines */
  74. };
  75.  
  76. struct curcolorRec {
  77.   int disp_one;            /* color map slots for graphics */
  78.   int disp_two;
  79.   char *default_cur;        /* default name of cursor color */
  80.   char *default_one;        /* default names of graphics colors */
  81.   char *default_two;
  82.   char *desired_cur;        /* setable name of cursor color */
  83.   char *desired_one;        /* setable names of graphics colors */
  84.   char *desired_two;
  85.   XColor color_cur;        /* description of the cursor color */
  86.   XColor color_one;        /* description of the graphics color */
  87.   XColor color_two;
  88. };
  89.  
  90. struct halftoneRec {
  91.   int mode;            /* dither, diffuse */
  92.   int matrixID;            /* Matrix1, Matrix2 */
  93.   int inverse;            /* halftone maintains it's own flag */
  94.   int pad;
  95.   short *matrix;        /* dithering weight matrix */
  96.   short *errbuf;        /* error diffusion error buffer */
  97. };
  98.  
  99. struct subtableRec {
  100.   int fixed_cells;        /* cellmap written directly (no table) */
  101.   int vertex_cnt;        /* number of vertices defined */
  102.   int map_sz;            /* number of cells in map */
  103.   int do_gamma;            /* flag for gamma correction != 1.0 */
  104.   int invert_order;        /* order inverted with negative contrast */
  105.   int pad;            /* hold space for double allignment */
  106.   double contrast;        /* cell = (base * contrast) + bias */
  107.   double bias;            /* base = (cell - bias) / contrast */
  108.   double gamma;            /* gamma correction factor */
  109.   double cell_level[PSEUDOSZ];    /* cell levels (usable range is 0-1) */
  110.   double base_level[PSEUDOSZ];    /* original levels - .5 (range -0.5-+0.5) */
  111.   double intensity[PSEUDOSZ];    /* intensity at each cell level (0-1) */
  112.   double cellmap[COLMAPSZ];    /* intensity by cell (0-1) */
  113.   double gammamap[COLMAPSZ];    /* intnsity by cell with gamma correction */
  114. };
  115.  
  116. struct colorTable {
  117.   struct subtableRec red;
  118.   struct subtableRec green;
  119.   struct subtableRec blue;
  120. };
  121.  
  122. struct scalemodeRec {
  123.   int mode;
  124.   int wrap_cnt;
  125.   double root_power;
  126.   double log_expo;
  127. };
  128.  
  129. struct colorRec {
  130.   Display *display;        /* display server */
  131.   int screen;            /* screen id for display server */
  132.   int screen_depth;        /* number of color hardware planes */
  133.   Visual *visual;        /* visual of the current colormap */
  134.   Colormap colormap;        /* server colormap being used */
  135.   int monochrome;        /* only one color with fixed values */
  136.   int single_plane;        /* one plane, use dither or diffuse */
  137.   int cursor_overlay;        /* overlay plane in use flag */
  138.   int ncolors;            /* number of colors reserved for image */
  139.   int inverse;            /* forward or inverse values */
  140.   int colormap_mode;        /* halftone, pseudo, fixed */
  141.   int color_tableID;        /* id of predefined colorset */
  142.   int control_mode;        /* ContBias, ThreshSat, gamma */
  143.   int control_mode_ext;        /* R_G_B, RGB (separate, combined) */
  144.   int colors_alloced;        /* flag that colors were alloc'ed */
  145.   int old_mode;            /* previous mode (when new change) */
  146.   int image_plane_mask;        /* mask for image planes only */
  147.   unsigned long overlay_mask;    /* mask with bit for overlay cursor */
  148.   struct scalemodeRec scale;    /* parameters for image scaling modes */
  149.   struct colmapRec map;        /* describe which colormap to use */
  150.   struct cellspecRec cells;    /* request for cells */
  151.   struct palletteRec hard;    /* read-only basic colors */
  152.   struct halftoneRec halftone;    /* halftoning stuff */
  153.   struct curcolorRec cur;    /* cursor drawing stuff */
  154.   struct gcsetRec gcset;    /* specifications of GC's used */
  155.   struct colorTable ctable;    /* pseudocolor vertex table */
  156.   unsigned long pixvalmap[COLMAPSZ];    /* byte val to hardware pixel val */
  157.   XColor cellstore[COLMAPSZ];        /* used to set colors */
  158. };
  159.