summaryrefslogtreecommitdiff
path: root/src/Xw/Xw_get_colormap_xid.cxx
blob: 14762e5f9ba4d900bc373ac858f695d08ff5402c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163

#include <Xw_Extension.h>

	/* ifdef then trace on */
#ifdef TRACE
#define TRACE_GET_COLORMAP_XID
#endif

/*
   Aspect_Handle Xw_get_colormap_xid (acolormap):
   XW_EXT_COLORMAP *acolormap

	Returns the colormap  XId 

*/

#ifdef XW_PROTOTYPE
Aspect_Handle Xw_get_colormap_xid (void* acolormap)
#else
Aspect_Handle Xw_get_colormap_xid (acolormap)
void *acolormap;
#endif /*XW_PROTOTYPE*/
{
XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap;

        if( !Xw_isdefine_colormap(pcolormap) ) {
            /*ERROR*Bad EXT_COLORMAP Address*/
            Xw_set_error(42,"Xw_get_colormap_xid",pcolormap) ;
            return (0) ;
        }

#ifdef  TRACE_GET_COLORMAP_XID
if( Xw_get_trace() > 1 ) {
    printf (" %lx = Xw_get_colormap_xid(%lx)\n",(long ) _CINFO.colormap,(long ) pcolormap) ;
}
#endif

	return (_CINFO.colormap) ;
}

#ifdef TRACE
#define TRACE_GET_COLORMAP_COLORCUBE
#endif

/*
   XW_STATUS Xw_get_colormap_colorcube (acolormap,
		colormap,visualid,base_pixel,red_max,red_mult,
			green_max,green_mult,blue_max,blue_mult):
   XW_EXT_COLORMAP *acolormap
   Aspect_Handle *colormap
   int *visualid
   int *base_pixel,*red_max,*red_mult,*green_max,*green_mult,*blue_max,*blue_mult

	Returns  TRUE if the colormap provide a color-cube definition 

*/

#ifdef XW_PROTOTYPE
XW_STATUS Xw_get_colormap_colorcube (void* acolormap,
		Aspect_Handle *colormap,int *visualid,int *base_pixel,
			int *red_max,int *red_mult,int *green_max,int *green_mult,
				int *blue_max,int *blue_mult)
#else
XW_STATUS Xw_get_colormap_colorcube (acolormap,
		colormap,visualid,base_pixel,red_max,red_mult,green_max,green_mult,
				blue_max,blue_mult)
void *acolormap;
Aspect_Handle *colormap;
int *visualid;
int *base_pixel,*red_max,*red_mult,*green_max,*green_mult,*blue_max,*blue_mult;
#endif /*XW_PROTOTYPE*/
{
XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap;
XW_STATUS status = XW_SUCCESS;

        if( !Xw_isdefine_colormap(pcolormap) ) {
            /*ERROR*Bad EXT_COLORMAP Address*/
            Xw_set_error(42,"Xw_get_colormap_colorcube",pcolormap) ;
            return (XW_ERROR) ;
        }

        *colormap = _CINFO.colormap;
        *visualid = _CINFO.visualid;
        *base_pixel = _CINFO.base_pixel;
	*red_max = _CINFO.red_max;
	*red_mult = _CINFO.red_mult;
	*green_max = _CINFO.green_max;
	*green_mult = _CINFO.green_mult;
	*blue_max = _CINFO.blue_max;
	*blue_mult = _CINFO.blue_mult;

	if( _CINFO.red_mult <= 0 ) {
	  status = XW_ERROR;
	}

#ifdef  TRACE_GET_COLORMAP_COLORCUBE
if( Xw_get_trace() > 1 ) {
    printf (" %d = Xw_get_colormap_colorcube(%lx,%lx,%d,%d,%d,%d,%d,%d,%d,%d)\n",
	status,(long ) pcolormap,*colormap,*visualid,*base_pixel,*red_max,*red_mult,
			*green_max,*green_mult,*blue_max,*blue_mult) ;
}
#endif

	return (status) ;
}

#ifdef TRACE
#define TRACE_GET_COLORMAP_GRAYRAMP
#endif

/*
   XW_STATUS Xw_get_colormap_grayramp (acolormap,
		colormap,visualid,base_pixel,gray_max,gray_mult):
   XW_EXT_COLORMAP *acolormap
   Aspect_Handle *colormap
   int *visualid
   int *base_pixel,*gray_max,*gray_mult

	Returns  TRUE if the colormap provide a gray_ramp definition 

*/

#ifdef XW_PROTOTYPE
XW_STATUS Xw_get_colormap_grayramp (void* acolormap,
		Aspect_Handle *colormap,int *visualid,int *base_pixel,
			int *gray_max,int *gray_mult)
#else
XW_STATUS Xw_get_colormap_grayramp (acolormap,
		colormap,visualid,base_pixel,gray_max,gray_mult)
void *acolormap;
Aspect_Handle *colormap;
int *visualid;
int *base_pixel,*gray_max,*gray_mult;
#endif /*XW_PROTOTYPE*/
{
XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap;
XW_STATUS status = XW_SUCCESS;

        if( !Xw_isdefine_colormap(pcolormap) ) {
            /*ERROR*Bad EXT_COLORMAP Address*/
            Xw_set_error(42,"Xw_get_colormap_grayramp",pcolormap) ;
            return (XW_ERROR) ;
        }

        *colormap = _CGINFO.colormap;
        *visualid = _CGINFO.visualid;
        *base_pixel = _CGINFO.base_pixel;
	*gray_max = _CGINFO.red_max;
	*gray_mult = _CGINFO.red_mult;

	if( _CGINFO.red_mult <= 0 ) {
	  status = XW_ERROR;
	}

#ifdef  TRACE_GET_COLORMAP_GRAYRAMP
if( Xw_get_trace() > 1 ) {
    printf (" %d = Xw_get_colormap_grayramp(%lx,%lx,%d,%d,%d,%d)\n",
	status,(long ) pcolormap,*colormap,*visualid,*base_pixel,*gray_max,*gray_mult);
}
#endif

	return (status) ;
}