Subversion Repositories tendra.SVN

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
#   		 Crown Copyright (c) 1997
2
#   
3
#   This TenDRA(r) Computer Program is subject to Copyright
4
#   owned by the United Kingdom Secretary of State for Defence
5
#   acting through the Defence Evaluation and Research Agency
6
#   (DERA).  It is made available to Recipients with a
7
#   royalty-free licence for its use, reproduction, transfer
8
#   to other parties and amendment for any purpose not excluding
9
#   product development provided that any such use et cetera
10
#   shall be deemed to be acceptance of the following conditions:-
11
#   
12
#       (1) Its Recipients shall ensure that this Notice is
13
#       reproduced upon any copies or amended versions of it;
14
#   
15
#       (2) Any amended version of it shall be clearly marked to
16
#       show both the nature of and the organisation responsible
17
#       for the relevant amendment or amendments;
18
#   
19
#       (3) Its onward transfer from a recipient to another
20
#       party shall be deemed to be that party's acceptance of
21
#       these conditions;
22
#   
23
#       (4) DERA gives no warranty or assurance as to its
24
#       quality or suitability for any purpose and DERA accepts
25
#       no liability whatsoever in relation to any use to which
26
#       it may be put.
27
#
28
# Colour management facilities
29
 
30
+USE "x5/lib", "X11/Xlib.h" ;		# needed
31
 
32
 
33
# Colour Structures (6.1)
34
 
35
+TYPE ( int ) XcmsColorFormat ;		# RCA : ulong in spec, uint in mit
36
+TYPEDEF double XcmsFloat ;
37
 
38
+FIELD ( struct ) XcmsRGB := { unsigned short red, green, blue ; } ;
39
+FIELD ( struct ) XcmsRGBi := { XcmsFloat red, green, blue ; } ;
40
+FIELD ( struct ) XcmsCIEXYZ := { XcmsFloat X, Y, Z ; } ;
41
+FIELD ( struct ) XcmsCIEuvY := { XcmsFloat u_prime, v_prime, Y ; } ;
42
+FIELD ( struct ) XcmsCIExyY := { XcmsFloat x, y, Y ; } ;
43
+FIELD ( struct ) XcmsCIELab := { XcmsFloat L_star, a_star, b_star ; } ;
44
+FIELD ( struct ) XcmsCIELuv := { XcmsFloat L_star, u_star, v_star ; } ;
45
+FIELD ( struct ) XcmsTekHVC := { XcmsFloat H, V, C ; } ;
46
+FIELD ( struct ) XcmsPad := { XcmsFloat pad0, pad1, pad2, pad3 ; } ;
47
 
48
+FIELD union ~XcmsSpec := {
49
    XcmsRGB RGB ;
50
    XcmsRGBi RGBi ;
51
    XcmsCIEXYZ CIEXYZ ;
52
    XcmsCIEuvY CIEuvY ;
53
    XcmsCIExyY CIExyY ;
54
    XcmsCIELab CIELab ;
55
    XcmsCIELuv CIELuv ;
56
    XcmsTekHVC TekHVC ;
57
    XcmsPad Pad ;
58
} ;
59
 
60
+FIELD ( struct ) XcmsColor := {
61
    union ~XcmsSpec spec ;
62
    XcmsColorFormat format ;
63
    unsigned long pixel ;
64
} ;
65
 
66
+DEFINE XcmsUndefinedFormat	%% 0x00000000 %% ;
67
+DEFINE XcmsCIEXYZFormat	%% 0x00000001 %% ;
68
+DEFINE XcmsCIEuvYFormat	%% 0x00000002 %% ;
69
+DEFINE XcmsCIExyYFormat	%% 0x00000003 %% ;
70
+DEFINE XcmsCIELabFormat	%% 0x00000004 %% ;
71
+DEFINE XcmsCIELuvFormat	%% 0x00000005 %% ;
72
+DEFINE XcmsTekHVCFormat	%% 0x00000006 %% ;
73
+DEFINE XcmsRGBFormat		%% 0x80000000 %% ;
74
+DEFINE XcmsRGBiFormat		%% 0x80000001 %% ;
75
 
76
 
77
# Mapping colour names to values (6.5)
78
 
79
+CONST Status XcmsSuccess, XcmsSuccessWithCompression, XcmsFailure ;
80
+FUNC Status XcmsLookupColor ( Display *, Colormap, char *, XcmsColor *,
81
    XcmsColor *, XcmsColorFormat ) ;
82
 
83
 
84
# Allocating and Freeing Colour cells (6.6)
85
 
86
+FUNC Status XcmsAllocColor ( Display *, Colormap, XcmsColor *,
87
    XcmsColorFormat ) ;
88
+FUNC Status XcmsAllocNamedColor ( Display *, Colormap, char *,
89
    XcmsColor *, XcmsColor *, XcmsColorFormat ) ; # RCA : Error in spec?
90
 
91
 
92
# Modifying and Querying Colormap Cells (6.7)
93
 
94
+FUNC Status XcmsStoreColor ( Display *, Colormap, XcmsColor * ) ;
95
+FUNC Status XcmsStoreColors ( Display *, Colormap, XcmsColor [],
96
    unsigned int, Bool [] ) ;	# RCA : Error in spec ?
97
+FUNC Status XcmsQueryColor ( Display *, Colormap, XcmsColor *,
98
    XcmsColorFormat ) ;
99
+FUNC Status XcmsQueryColors ( Display *, Colormap, XcmsColor [],
100
    unsigned int, XcmsColorFormat ) ;
101
 
102
 
103
# Colour Conversion Contexts (6.8, 6.10.1, 6.10.3)
104
 
105
+TYPE ~XcmsCCCRec ;
106
+TYPEDEF ~XcmsCCCRec *XcmsCCC ;	# RCA : no information given
107
 
108
+TYPEDEF Status ( *XcmsCompressionProc ) ( XcmsCCC, XcmsColor [],
109
    unsigned int, unsigned int, Bool [] ) ;
110
 
111
+TYPEDEF Status ( *XcmsWhiteAdjustProc ) ( XcmsCCC, XcmsColor *,
112
    XcmsColor *, XcmsColorFormat, XcmsColor [], unsigned int, Bool [] ) ;
113
 
114
 
115
# Getting and Setting CCC of a Colormap (6.8.1)
116
 
117
+FUNC XcmsCCC XcmsCCCOfColormap ( Display *, Colormap ) ;
118
+FUNC XcmsCCC XcmsSetCCCOfColormap ( Display *, Colormap, XcmsCCC ) ;
119
 
120
 
121
# Getting the default CC (6.8.2)
122
 
123
+FUNC XcmsCCC XcmsDefaultCCC ( Display *, int ) ;
124
 
125
 
126
# CCC macros (6.8.3)
127
 
128
+FUNC Display *XcmsDisplayOfCCC ( XcmsCCC ) ;
129
+FUNC Visual *XcmsVisualOfCCC ( XcmsCCC ) ;
130
+FUNC int XcmsScreenNumberOfCCC ( XcmsCCC ) ;
131
+FUNC XcmsColor *XcmsScreenWhitePointOfCCC ( XcmsCCC ) ;
132
+FUNC XcmsColor *XcmsClientWhitePointOfCCC ( XcmsCCC ) ;
133
 
134
+MACRO Display *DisplayOfCCC ( XcmsCCC ) ;
135
+MACRO Visual *VisualOfCCC ( XcmsCCC ) ;
136
+MACRO int ScreenNumberOfCCC ( XcmsCCC ) ;
137
+MACRO XcmsColor *ScreenWhitePointOfCCC ( XcmsCCC ) ;
138
+MACRO XcmsColor *ClientWhitePointOfCCC ( XcmsCCC ) ;
139
 
140
 
141
# Modifying attributes of a CCC (6.8.4)
142
 
143
+FUNC Status XcmsSetWhitePoint ( XcmsCCC, XcmsColor * ) ;
144
+FUNC XcmsCompressionProc XcmsSetCompressionProc ( XcmsCCC,
145
    XcmsCompressionProc, XPointer ) ;
146
+FUNC XcmsWhiteAdjustProc XcmsSetWhiteAdjustProc ( XcmsCCC,
147
    XcmsWhiteAdjustProc, XPointer ) ;
148
 
149
 
150
# Creating and Freeing a CCC (6.8.5)
151
 
152
+FUNC XcmsCCC XcmsCreateCCC ( Display *, int, Visual *, XcmsColor *,
153
    XcmsCompressionProc, XPointer, XcmsWhiteAdjustProc, XPointer ) ;
154
+FUNC void XcmsFreeCCC ( XcmsCCC ) ;
155
 
156
 
157
# Converting between Colour spaces (6.9)
158
 
159
+FUNC Status XcmsConvertColors ( XcmsCCC, XcmsColor [], unsigned int,
160
    XcmsColorFormat, Bool [] ) ;
161
 
162
 
163
# Supplied Gamut Compression Procedures (6.10.2)
164
 
165
+FUNC Status XcmsCIELabClipL ( XcmsCCC, XcmsColor [], unsigned int,
166
    unsigned int, Bool [] ) ;
167
+FUNC Status XcmsCIELabClipab ( XcmsCCC, XcmsColor [], unsigned int,
168
    unsigned int, Bool [] ) ;
169
+FUNC Status XcmsCIELabClipLab ( XcmsCCC, XcmsColor [], unsigned int,
170
    unsigned int, Bool [] ) ;
171
+FUNC Status XcmsCIELuvClipL ( XcmsCCC, XcmsColor [], unsigned int,
172
    unsigned int, Bool [] ) ;
173
+FUNC Status XcmsCIELuvClipuv ( XcmsCCC, XcmsColor [], unsigned int,
174
    unsigned int, Bool [] ) ;
175
+FUNC Status XcmsCIELuvClipLuv ( XcmsCCC, XcmsColor [], unsigned int,
176
    unsigned int, Bool [] ) ;
177
+FUNC Status XcmsTekHVCClipV ( XcmsCCC, XcmsColor [], unsigned int,
178
    unsigned int, Bool [] ) ;
179
+FUNC Status XcmsTekHVCClipC ( XcmsCCC, XcmsColor [], unsigned int,
180
    unsigned int, Bool [] ) ;
181
+FUNC Status XcmsTekHVCClipVC ( XcmsCCC, XcmsColor [], unsigned int,
182
    unsigned int, Bool [] ) ;
183
 
184
 
185
# Supplied White Point Adjustment Procedures (6.10.4)
186
 
187
+FUNC Status XcmsCIELabWhiteShiftColors ( XcmsCCC, XcmsColor *,
188
    XcmsColor *, XcmsColorFormat, XcmsColor [], unsigned int, Bool [] ) ;
189
+FUNC Status XcmsCIELuvWhiteShiftColors ( XcmsCCC, XcmsColor *,
190
    XcmsColor *, XcmsColorFormat, XcmsColor [], unsigned int, Bool [] ) ;
191
+FUNC Status XcmsTekHVCWhiteShiftColors ( XcmsCCC, XcmsColor *,
192
    XcmsColor *, XcmsColorFormat, XcmsColor [], unsigned int, Bool [] ) ;
193
 
194
 
195
# Red, Green and Blue Queries (6.11.1)
196
 
197
+FUNC Status XcmsQueryBlack ( XcmsCCC, XcmsColorFormat, XcmsColor * ) ;
198
+FUNC Status XcmsQueryBlue ( XcmsCCC, XcmsColorFormat, XcmsColor * ) ;
199
+FUNC Status XcmsQueryGreen ( XcmsCCC, XcmsColorFormat, XcmsColor * ) ;
200
+FUNC Status XcmsQueryRed ( XcmsCCC, XcmsColorFormat, XcmsColor * ) ;
201
+FUNC Status XcmsQueryWhite ( XcmsCCC, XcmsColorFormat, XcmsColor * ) ;
202
 
203
 
204
# CIELab Queries (6.11.2)
205
 
206
+FUNC Status XcmsCIELabQueryMaxC ( XcmsCCC, XcmsFloat, XcmsFloat,
207
    XcmsColor * ) ;
208
+FUNC Status XcmsCIELabQueryMaxL ( XcmsCCC, XcmsFloat, XcmsFloat,
209
    XcmsColor * ) ;
210
+FUNC Status XcmsCIELabQueryMaxLC ( XcmsCCC, XcmsFloat, XcmsColor * ) ;
211
+FUNC Status XcmsCIELabQueryMinL ( XcmsCCC, XcmsFloat, XcmsFloat,
212
    XcmsColor * ) ;
213
 
214
 
215
# CIELuv Queries (6.11.3)
216
 
217
+FUNC Status XcmsCIELuvQueryMaxC ( XcmsCCC, XcmsFloat, XcmsFloat,
218
    XcmsColor * ) ;
219
+FUNC Status XcmsCIELuvQueryMaxL ( XcmsCCC, XcmsFloat, XcmsFloat,
220
    XcmsColor * ) ;
221
+FUNC Status XcmsCIELuvQueryMaxLC ( XcmsCCC, XcmsFloat, XcmsColor * ) ;
222
+FUNC Status XcmsCIELuvQueryMinL ( XcmsCCC, XcmsFloat, XcmsFloat,
223
    XcmsColor * ) ;
224
 
225
 
226
# TekHVC Queries (6.11.4)
227
 
228
+FUNC Status XcmsTekHVCQueryMaxC ( XcmsCCC, XcmsFloat, XcmsFloat,
229
    XcmsColor * ) ;
230
+FUNC Status XcmsTekHVCQueryMaxV ( XcmsCCC, XcmsFloat, XcmsFloat,
231
    XcmsColor * ) ;
232
+FUNC Status XcmsTekHVCQueryMaxVC ( XcmsCCC, XcmsFloat, XcmsColor * ) ;
233
+FUNC Status XcmsTekHVCQueryMaxVSamples ( XcmsCCC, XcmsFloat, XcmsColor [],
234
    unsigned int ) ;
235
+FUNC Status XcmsTekHVCQueryMinV ( XcmsCCC, XcmsFloat, XcmsFloat,
236
    XcmsColor * ) ;
237
 
238
 
239
# Creating Additional Colour spaces (6.12.4, 6.12.5)
240
 
241
+TYPEDEF Status ( *XcmsConversionProc ) () ;
242
+TYPEDEF XcmsConversionProc *XcmsFuncListPtr ;
243
+TYPEDEF int ( *XcmsParseStringProc ) ( char *, XcmsColor * )  ;
244
+FIELD ( struct ) XcmsColorSpace := {
245
    char *prefix ;
246
    XcmsColorFormat format ;
247
    XcmsParseStringProc parseString ;
248
    XcmsFuncListPtr to_CIEXYZ ;
249
    XcmsFuncListPtr from_CIEXYZ ;
250
    int inverse_flag ;
251
} ;
252
 
253
 
254
# Adding Device-independent Colour spaces (6.12.2)
255
 
256
+FUNC Status XcmsAddColorSpace ( XcmsColorSpace * ) ;
257
 
258
 
259
# Querying Colour spaces (6.12.3)
260
 
261
+FUNC XcmsColorFormat XcmsFormatOfPrefix ( char * ) ;
262
+FUNC char *XcmsPrefixOfFormat ( XcmsColorFormat ) ;
263
 
264
 
265
# Conversion Routines (6.12.6)
266
 
267
+FUNC Status XcmsCIELabToCIEXYZ ( XcmsCCC, XcmsColor *, XcmsColor *,
268
    unsigned int ) ;
269
+FUNC Status XcmsCIELuvToCIEuvY ( XcmsCCC, XcmsColor *, XcmsColor *,
270
    unsigned int ) ;
271
+FUNC Status XcmsCIEXYZToCIELab ( XcmsCCC, XcmsColor *, XcmsColor *,
272
    unsigned int ) ;
273
+FUNC Status XcmsCIEXYZToCIEuvY ( XcmsCCC, XcmsColor *, XcmsColor *,
274
    unsigned int ) ;
275
+FUNC Status XcmsCIEXYZToCIExyY ( XcmsCCC, XcmsColor *, XcmsColor *,
276
    unsigned int ) ;
277
+FUNC Status XcmsCIEuvYToCIELuv ( XcmsCCC, XcmsColor *, XcmsColor *,
278
    unsigned int ) ;
279
+FUNC Status XcmsCIEuvYToCIEXYZ ( XcmsCCC, XcmsColor *, XcmsColor *,
280
    unsigned int ) ;
281
+FUNC Status XcmsCIEuvYToTekHVC ( XcmsCCC, XcmsColor *, XcmsColor *,
282
    unsigned int ) ;
283
+FUNC Status XcmsCIExyYToCIEXYZ ( XcmsCCC, XcmsColor *, XcmsColor *,
284
    unsigned int ) ;
285
+FUNC Status XcmsTekHVCToCIEuvY ( XcmsCCC, XcmsColor *, XcmsColor *,
286
    unsigned int ) ;
287
 
288
+FUNC Status XcmsCIEXYZToRGBi ( XcmsCCC, XcmsColor *, unsigned int, Bool * ) ;
289
+FUNC Status XcmsRGBToRGBi ( XcmsCCC, XcmsColor *, unsigned int, Bool * ) ;
290
+FUNC Status XcmsRGBiToCIEXYZ ( XcmsCCC, XcmsColor *, unsigned int, Bool * ) ;
291
+FUNC Status XcmsRGBiToRGB ( XcmsCCC, XcmsColor *, unsigned int, Bool * ) ;
292
 
293
 
294
# Adding Function Sets (6.12.8, 6.12.9)
295
 
296
+FIELD ( struct ) XcmsPerScrnInfo := {
297
    XcmsColor screenWhitePoint ;
298
    XPointer functionSet ;
299
    XPointer screenData ;
300
    unsigned char state ;
301
    char pad [3] ;
302
} ;
303
 
304
+TYPEDEF Status ( *XcmsScreenInitProc ) ( Display *, int,
305
    XcmsPerScrnInfo * ) ;
306
+TYPEDEF void ( *XcmsScreenFreeProc ) ( XPointer ) ;
307
 
308
+CONST Status XcmsInitNone, XcmsInitFailure, XcmsInitSuccess ;
309
 
310
+FIELD ( struct ) XcmsFunctionSet := {
311
    XcmsColorSpace **DDColorSpaces ;
312
    XcmsScreenInitProc screenInitProc ;
313
    XcmsScreenFreeProc screenFreeProc ;
314
} ;
315
 
316
+FUNC Status XcmsAddFunctionSet ( XcmsFunctionSet * ) ;