VIA - Volumetric Image Analysis
colormap.h
00001 /*
00002  *  $Id: colormap.h 726 2004-03-08 13:12:45Z lohmann $
00003  *
00004  *  This file contains definitions for Vista library support of X Windows
00005  *  colormap allocation.
00006  */
00007 
00008 /*
00009  *  Copyright 1993, 1994 University of British Columbia
00010  *
00011  *  Permission to use, copy, modify, distribute, and sell this software and its
00012  *  documentation for any purpose is hereby granted without fee, provided that
00013  *  the above copyright notice appears in all copies and that both that
00014  *  copyright notice and this permission notice appear in supporting
00015  *  documentation. UBC makes no representations about the suitability of this
00016  *  software for any purpose. It is provided "as is" without express or
00017  *  implied warranty.
00018  *
00019  *  Authors: Dan Razzell, Art Pope
00020  *           UBC Laboratory for Computational Intelligence
00021  */
00022 
00023 #ifndef V_colormap_h
00024 #define V_colormap_h 1
00025 
00026 /* From X Windows libraries: */
00027 #include <X11/Xlib.h>
00028 #include <X11/Intrinsic.h>
00029 
00030 /* For portability: */
00031 #include <X11/Xfuncproto.h>
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 
00038 /*
00039  * Colormap type definition.
00040  */
00041 
00042 typedef struct V_ColormapRec {
00043     Screen *screen;
00044     Atom property;
00045     XVisualInfo vinfo;
00046 
00047     /* A standard colormap describes the color mapping: */
00048     XStandardColormap stdcmap;
00049 
00050     /* If the colors allocated are not contiguous, the pixel values computed
00051        using stdcmap are used to index the following table, from which the
00052        actual pixel values are obtained: */
00053     unsigned long *indcmap;
00054     VBoolean *indcmap_alloced;          /* which need freeing */
00055 
00056     /* All grayscale rendering uses this ramp of pixel values: */
00057     int ngrays;
00058     unsigned long *invgmap;
00059     VBoolean *invgmap_alloced;          /* which need freeing */
00060 } *VColormap;
00061 
00062 
00063 /*
00064  *  Colormap accessors.
00065  */
00066 
00067 #define VColormapColormap(vc)   ((vc)->stdcmap.colormap)
00068 #define VColormapDepth(vc)      ((vc)->vinfo.depth)
00069 #define VColormapProperty(vc)   ((vc)->property)
00070 #define VColormapVisual(vc)     ((vc)->vinfo.visual)
00071 
00072 
00073 /*
00074  *  Declarations of library routines.
00075  */
00076 
00077 extern VColormap VCreateColormap (
00078 #if NeedFunctionPrototypes
00079     Screen *            /* screen */,
00080     Atom                /* property */,
00081     long                /* vinfo_mask */,
00082     XVisualInfo *       /* vinfo_template */
00083 #endif
00084 );
00085 
00086 extern void VDestroyColormap (
00087 #if NeedFunctionPrototypes
00088     VColormap           /* vcolormap */
00089 #endif
00090 );
00091 
00092 extern void VColormapRGBPixel (
00093 #if NeedFunctionPrototypes
00094     VColormap           /* vcolormap */,
00095     XColor *            /* color */
00096 #endif
00097 );
00098 
00099 extern void VColormapGrayPixel (
00100 #if NeedFunctionPrototypes
00101     VColormap           /* vcolormap */,
00102     XColor *            /* color */
00103 #endif
00104 );
00105 
00106 #ifdef __cplusplus
00107 }
00108 #endif
00109 
00110 #endif /* V_colormap_h */