1 /* Copyright (C) 1993, 1992 Nathan Sidwell */
2 /* this file is common to xmris and xmred, included from def*.h */
3 /* RCS $Id: defcom.h,v 4.5 1994/01/25 18:33:03 nathan Stable $ */
4 #include <X11/StringDefs.h>
5 #include <X11/Shell.h>
6 #define XtRGender       "Gender"
7 #define COLOR_PLANES 3  /* max color planes for sprite generation */
8 /*{{{  some macros*/
9 #define RGB2X(r, g, b)  (int)(((long)(b) - (long)(r)) * (56756 / 2) / 65536)
10 #define RGB2Y(r, g, b)  (int)(((long)(g) - ((long)(r) + (long)(b)) / 2) / 2)
11 #define RGB2H(r, g, b)  (int)(((long)(g) * 4 + (long)(r) * 3 + (long)(b)) / 8)
12 /*}}}*/
13 /*{{{  structs*/
14 /*{{{  typedef struct Help*/
15 typedef struct Help
16 /* command line argument specifier */
17 {
18   char CONST *help;     /* help message */
19   char CONST *arg;      /* arg text */
20   char CONST *resource; /* resource name */
21   char CONST *option;   /* option type */
22 } HELP;
23 /*}}}*/
24 /*{{{  typedef struct Context*/
25 typedef struct Context
26 /* GC definer */
27 {
28   int       function;         /* graphics function */
29   unsigned long CONST *fgp;   /* foreground color pointer */
30   unsigned long CONST *bgp;   /* background color pointer */
31 } CONTEXT;
32 /*}}}*/
33 /*{{{  typedef struct Sprite_Def*/
34 typedef struct Sprite_Def
35 /* sprite definition */
36 {
37   unsigned char *bitmap;  /* image bitmap */
38   unsigned  planes;       /* number of planes in bitmap */
39   unsigned long *colors[2];    /* colors arrays */
40   SIZE      size;         /* size of sprite */
41   SIZE      expected;     /* expected size */
42   unsigned  copy;         /* generated from this sprite */
43   unsigned  flags;        /* reflection mode, or border bits */
44 } SPRITE_DEF;
45 #define REFLECT_ALIAS       0 /* alias */
46 #define REFLECT_VERTICAL    1 /* vertical axis reflect */
47 #define REFLECT_HORIZONTAL  2 /* horizontal axis reflect */
48 #define REFLECT_DIAGONAL    3 /* 45' axis reflect */
49 #define BORDER_HALO_MASK          1  /* halo */
50 #define BORDER_MONOSWAP_EDGE_MASK 2  /* -mono -swap outer white */
51 #define BORDER_WHITE_EDGE_MASK    4  /* color outer white */
52 /*}}}*/
53 /*{{{  typedef struct Color_Def*/
54 typedef struct Color_Def
55 {
56   char CONST *name;       /* my name for the color */
57   unsigned  type;         /* type of color
58 			   * bit0-3, mris, mris.swap, msit, msit.swap
59 			   * bit4 - background
60 			   * bit5 - dynamic
61 			   */
62   char CONST *source[4];  /* possible names for the color */
63   unsigned alloc;         /*
64 			   * 0 - unallocated
65 			   * 1 - allocated
66 			   * 2 - copy
67 			   * 3 - missed
68 			   * 4 - unrequired
69 			   * 5 - info
70 			   */
71   int       coord[3];     /* position in colorspace */
72   struct Color_Def  *nearest;    /* nearest allocated color */
73   unsigned long distance; /* distance to nearest */
74 } COLOR_DEF;
75 /*}}}*/
76 /*{{{  typedef struct Visual_Class*/
77 typedef struct Visual_Class
78 {
79   char CONST *name;       /* class name */
80   int       class;        /* visual class */
81 } VISUAL_CLASS;
82 /*}}}*/
83 /*}}}*/
84 extern unsigned long color_zero;
85 extern unsigned long color_one;
86 extern Boolean  default_gender;
87 /*{{{  create tables*/
88 extern CommandOptionDesc command_options[];
89 extern XrmOptionDescRec options[];
90 extern XtResource resources[];
91 extern COLOR_DEF color_names[];
92 extern CONTEXT gcsdefine[GCS];
93 extern HELP CONST help[];
94 extern SPRITE_DEF CONST she_nadger[];
95 extern SPRITE_DEF CONST icons[];
96 extern SPRITE_DEF sprites_def[SPRITES];
97 extern SPRITE_DEF fills_def[FILLS];
98 extern VISUAL_CLASS CONST visual_class[];
99 /*}}}*/
100