summaryrefslogtreecommitdiff
path: root/src/Xw/Xw_isdefine_color.cxx
blob: f97402e066b055f1e2181240adf20a0f88d4576f (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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182

#include <Xw_Extension.h>

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

/*
   XW_STATUS Xw_isdefine_color(acolormap,index):
   XW_EXT_COLORMAP *acolormap	Colormap extension structure
   int index ;		Color index 0 >= x < MAXCOLOR

	Returns XW_ERROR if BadColor index or Color is not define
	Returns XW_SUCCESS if Color is defined

*/
#ifdef XW_PROTOTYPE
XW_STATUS Xw_isdefine_color (void* acolormap, int index)
#else
XW_STATUS Xw_isdefine_color (acolormap,index)
void *acolormap;
int index ;
#endif /*XW_PROTOTYPE*/
{
XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ;
XW_STATUS status = XW_ERROR ;
//int i ;

	if( pcolormap && ((index < 0) || 
		((index >= 0) && (index < pcolormap->maxcolor) &&
		    		(pcolormap->define[index]))) ) {
	    status = XW_SUCCESS ;
	}

#ifdef TRACE_ISDEFINE_COLOR
if( Xw_get_trace() > 2 ) {
    printf(" %d = Xw_isdefine_color(%lx,%d)\n",status,(long ) pcolormap,index) ;
}
#endif

	return (status);
}

#ifdef XW_PROTOTYPE
XW_STATUS Xw_isdefine_colorindex (XW_EXT_COLORMAP* acolormap, int index)
#else
XW_STATUS Xw_isdefine_colorindex (acolormap,index)
XW_EXT_COLORMAP *acolormap;
int index ;
#endif /*XW_PROTOTYPE*/
/*
	Verify Index range Only
*/
{
XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ;
XW_STATUS status = XW_ERROR ;

	if( pcolormap && (index >= 0) && (index < pcolormap->maxcolor) ) {
	    status = XW_SUCCESS ;
	}

#ifdef TRACE_ISDEFINE_COLOR
if( Xw_get_trace() > 2 ) {
    printf(" %d = Xw_isdefine_colorindex(%lx,%d)\n",status,(long ) pcolormap,index) ;
}
#endif

	return (status) ;
}
#ifdef XW_PROTOTYPE
XW_STATUS Xw_ifsystem_colorindex (XW_EXT_COLORMAP* acolormap, int index)
#else
XW_STATUS Xw_ifsystem_colorindex (acolormap,index)
XW_EXT_COLORMAP *acolormap;
int index ;
#endif /*XW_PROTOTYPE*/
/*
	Check if System color index
*/
{
XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ;
XW_STATUS status = XW_ERROR ;

	if( pcolormap && (index >= 0) && (index < pcolormap->maxcolor) &&
			(pcolormap->define[index] == SYSTEMCOLOR) ) {
	    status = XW_SUCCESS ;
	}

#ifdef TRACE_ISDEFINE_COLOR
if( Xw_get_trace() > 2 ) {
    printf(" %d = Xw_ifsystem_colorindex(%lx,%d)\n",status,(long ) pcolormap,index) ;
}
#endif

	return (status) ;
}

#ifdef XW_PROTOTYPE
XW_STATUS Xw_ifimage_colorindex (XW_EXT_COLORMAP* acolormap, int index)
#else
XW_STATUS Xw_ifimage_colorindex (acolormap,index)
XW_EXT_COLORMAP *acolormap;
int index ;
#endif /*XW_PROTOTYPE*/
/*
	Check if image color index
*/
{
XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ;
XW_STATUS status = XW_ERROR ;

	if( pcolormap && (index >= 0) && (index < pcolormap->maxcolor) &&
			(pcolormap->define[index] == IMAGECOLOR) ) {
	    status = XW_SUCCESS ;
	}

#ifdef TRACE_ISDEFINE_COLOR
if( Xw_get_trace() > 2 ) {
    printf(" %d = Xw_ifimage_colorindex(%lx,%d)\n",status,(long ) pcolormap,index) ;
}
#endif

	return (status) ;
}

#ifdef XW_PROTOTYPE
XW_STATUS Xw_ifbackground_colorindex (XW_EXT_COLORMAP* acolormap, int index)
#else
XW_STATUS Xw_ifbackground_colorindex (acolormap,index)
XW_EXT_COLORMAP *acolormap;
int index ;
#endif /*XW_PROTOTYPE*/
/*
	Check if background color index
*/
{
XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ;
XW_STATUS status = XW_ERROR ;

	if( pcolormap && ((index < 0) || 
		((index >= 0) && (index < pcolormap->maxcolor) &&
			(pcolormap->define[index] == BACKCOLOR))) ) {
	    status = XW_SUCCESS ;
	}

#ifdef TRACE_ISDEFINE_COLOR
if( Xw_get_trace() > 2 ) {
    printf(" %d = Xw_ifbackground_colorindex(%lx,%d)\n",status,(long ) pcolormap,index) ;
}
#endif

	return (status) ;
}

#ifdef XW_PROTOTYPE
XW_STATUS Xw_ifhighlight_colorindex (XW_EXT_COLORMAP* acolormap, int index)
#else
XW_STATUS Xw_ifhighlight_colorindex (acolormap,index)
XW_EXT_COLORMAP *acolormap;
int index ;
#endif /*XW_PROTOTYPE*/
/*
	Check if highlight color index
*/
{
XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ;
XW_STATUS status = XW_ERROR ;

	if( pcolormap && (index >= 0) && (index < pcolormap->maxcolor) &&
			(pcolormap->define[index] == HIGHCOLOR) ) {
	    status = XW_SUCCESS ;
	}

#ifdef TRACE_ISDEFINE_COLOR
if( Xw_get_trace() > 2 ) {
    printf(" %d = Xw_ifhighlight_colorindex(%lx,%d)\n",status,(long ) pcolormap,index) ;
}
#endif

	return (status) ;
}