VIA - Volumetric Image Analysis
vxlib/colormap.h
1 /*
2  * $Id: colormap.h 726 2004-03-08 13:12:45Z lohmann $
3  *
4  * This file contains definitions for Vista library support of X Windows
5  * colormap allocation.
6  */
7 
8 /*
9  * Copyright 1993, 1994 University of British Columbia
10  *
11  * Permission to use, copy, modify, distribute, and sell this software and its
12  * documentation for any purpose is hereby granted without fee, provided that
13  * the above copyright notice appears in all copies and that both that
14  * copyright notice and this permission notice appear in supporting
15  * documentation. UBC makes no representations about the suitability of this
16  * software for any purpose. It is provided "as is" without express or
17  * implied warranty.
18  *
19  * Authors: Dan Razzell, Art Pope
20  * UBC Laboratory for Computational Intelligence
21  */
22 
23 #ifndef V_colormap_h
24 #define V_colormap_h 1
25 
26 /* From X Windows libraries: */
27 #include <X11/Xlib.h>
28 #include <X11/Intrinsic.h>
29 
30 /* For portability: */
31 #include <X11/Xfuncproto.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 
38 /*
39  * Colormap type definition.
40  */
41 
42 typedef struct V_ColormapRec {
43  Screen *screen;
44  Atom property;
45  XVisualInfo vinfo;
46 
47  /* A standard colormap describes the color mapping: */
48  XStandardColormap stdcmap;
49 
50  /* If the colors allocated are not contiguous, the pixel values computed
51  using stdcmap are used to index the following table, from which the
52  actual pixel values are obtained: */
53  unsigned long *indcmap;
54  VBoolean *indcmap_alloced; /* which need freeing */
55 
56  /* All grayscale rendering uses this ramp of pixel values: */
57  int ngrays;
58  unsigned long *invgmap;
59  VBoolean *invgmap_alloced; /* which need freeing */
60 } *VColormap;
61 
62 
63 /*
64  * Colormap accessors.
65  */
66 
67 #define VColormapColormap(vc) ((vc)->stdcmap.colormap)
68 #define VColormapDepth(vc) ((vc)->vinfo.depth)
69 #define VColormapProperty(vc) ((vc)->property)
70 #define VColormapVisual(vc) ((vc)->vinfo.visual)
71 
72 
73 /*
74  * Declarations of library routines.
75  */
76 
77 extern VColormap VCreateColormap (
78 #if NeedFunctionPrototypes
79  Screen * /* screen */,
80  Atom /* property */,
81  long /* vinfo_mask */,
82  XVisualInfo * /* vinfo_template */
83 #endif
84 );
85 
86 extern void VDestroyColormap (
87 #if NeedFunctionPrototypes
88  VColormap /* vcolormap */
89 #endif
90 );
91 
92 extern void VColormapRGBPixel (
93 #if NeedFunctionPrototypes
94  VColormap /* vcolormap */,
95  XColor * /* color */
96 #endif
97 );
98 
99 extern void VColormapGrayPixel (
100 #if NeedFunctionPrototypes
101  VColormap /* vcolormap */,
102  XColor * /* color */
103 #endif
104 );
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 
110 #endif /* V_colormap_h */