-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMCalibrator.h
436 lines (388 loc) · 14.9 KB
/
CMCalibrator.h
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
/*
File: CMCalibrator.h
Contains: ColorSync Calibration API
Version: Technology: ColorSync 2.5
Release: Universal Interfaces 3.4
Copyright: © 1998-2001 by Apple Computer, Inc., all rights reserved.
Bugs?: For bug reports, consult the following page on
the World Wide Web:
http://developer.apple.com/bugreporter/
*/
#ifndef __CMCALIBRATOR__
#define __CMCALIBRATOR__
#ifndef __CMAPPLICATION__
#include <CMApplication.h>
#endif
#ifndef __EVENTS__
#include <Events.h>
#endif
#if PRAGMA_ONCE
#pragma once
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if PRAGMA_IMPORT
#pragma import on
#endif
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#elif PRAGMA_STRUCT_PACKPUSH
#pragma pack(push, 2)
#elif PRAGMA_STRUCT_PACK
#pragma pack(2)
#endif
typedef CALLBACK_API( void , CalibrateEventProcPtr )(EventRecord * event);
typedef STACK_UPP_TYPE(CalibrateEventProcPtr) CalibrateEventUPP;
/* Interface for new ColorSync monitor calibrators (ColorSync 2.6 and greater) */
enum {
kCalibratorNamePrefix = FOUR_CHAR_CODE('cali')
};
struct CalibratorInfo {
UInt32 dataSize; /* Size of this structure - compatibility */
CMDisplayIDType displayID; /* Contains an hDC on Win32 */
UInt32 profileLocationSize; /* Max size for returned profile location */
CMProfileLocation * profileLocationPtr; /* For returning the profile */
CalibrateEventUPP eventProc; /* Ignored on Win32 */
Boolean isGood; /* true or false */
};
typedef struct CalibratorInfo CalibratorInfo;
typedef CALLBACK_API( Boolean , CanCalibrateProcPtr )(CMDisplayIDType displayID, Str255 errMessage);
typedef CALLBACK_API( OSErr , CalibrateProcPtr )(CalibratorInfo * theInfo);
typedef STACK_UPP_TYPE(CanCalibrateProcPtr) CanCalibrateUPP;
typedef STACK_UPP_TYPE(CalibrateProcPtr) CalibrateUPP;
/*
* NewCalibrateEventUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 or later
*/
EXTERN_API_C( CalibrateEventUPP )
NewCalibrateEventUPP(CalibrateEventProcPtr userRoutine);
#if !OPAQUE_UPP_TYPES
enum { uppCalibrateEventProcInfo = 0x000000C0 }; /* pascal no_return_value Func(4_bytes) */
#ifdef __cplusplus
inline CalibrateEventUPP NewCalibrateEventUPP(CalibrateEventProcPtr userRoutine) { return (CalibrateEventUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCalibrateEventProcInfo, GetCurrentArchitecture()); }
#else
#define NewCalibrateEventUPP(userRoutine) (CalibrateEventUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCalibrateEventProcInfo, GetCurrentArchitecture())
#endif
#endif
/*
* NewCanCalibrateUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: not available
*/
EXTERN_API_C( CanCalibrateUPP )
NewCanCalibrateUPP(CanCalibrateProcPtr userRoutine);
#if !OPAQUE_UPP_TYPES
enum { uppCanCalibrateProcInfo = 0x000003D0 }; /* pascal 1_byte Func(4_bytes, 4_bytes) */
#ifdef __cplusplus
inline CanCalibrateUPP NewCanCalibrateUPP(CanCalibrateProcPtr userRoutine) { return (CanCalibrateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCanCalibrateProcInfo, GetCurrentArchitecture()); }
#else
#define NewCanCalibrateUPP(userRoutine) (CanCalibrateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCanCalibrateProcInfo, GetCurrentArchitecture())
#endif
#endif
/*
* NewCalibrateUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: not available
*/
EXTERN_API_C( CalibrateUPP )
NewCalibrateUPP(CalibrateProcPtr userRoutine);
#if !OPAQUE_UPP_TYPES
enum { uppCalibrateProcInfo = 0x000000E0 }; /* pascal 2_bytes Func(4_bytes) */
#ifdef __cplusplus
inline CalibrateUPP NewCalibrateUPP(CalibrateProcPtr userRoutine) { return (CalibrateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCalibrateProcInfo, GetCurrentArchitecture()); }
#else
#define NewCalibrateUPP(userRoutine) (CalibrateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCalibrateProcInfo, GetCurrentArchitecture())
#endif
#endif
/*
* DisposeCalibrateEventUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 or later
*/
EXTERN_API_C( void )
DisposeCalibrateEventUPP(CalibrateEventUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline void DisposeCalibrateEventUPP(CalibrateEventUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
#else
#define DisposeCalibrateEventUPP(userUPP) DisposeRoutineDescriptor(userUPP)
#endif
#endif
/*
* DisposeCanCalibrateUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: not available
*/
EXTERN_API_C( void )
DisposeCanCalibrateUPP(CanCalibrateUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline void DisposeCanCalibrateUPP(CanCalibrateUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
#else
#define DisposeCanCalibrateUPP(userUPP) DisposeRoutineDescriptor(userUPP)
#endif
#endif
/*
* DisposeCalibrateUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: not available
*/
EXTERN_API_C( void )
DisposeCalibrateUPP(CalibrateUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline void DisposeCalibrateUPP(CalibrateUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
#else
#define DisposeCalibrateUPP(userUPP) DisposeRoutineDescriptor(userUPP)
#endif
#endif
/*
* InvokeCalibrateEventUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 or later
*/
EXTERN_API_C( void )
InvokeCalibrateEventUPP(
EventRecord * event,
CalibrateEventUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline void InvokeCalibrateEventUPP(EventRecord * event, CalibrateEventUPP userUPP) { CALL_ONE_PARAMETER_UPP(userUPP, uppCalibrateEventProcInfo, event); }
#else
#define InvokeCalibrateEventUPP(event, userUPP) CALL_ONE_PARAMETER_UPP((userUPP), uppCalibrateEventProcInfo, (event))
#endif
#endif
/*
* InvokeCanCalibrateUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
InvokeCanCalibrateUPP(
CMDisplayIDType displayID,
Str255 errMessage,
CanCalibrateUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline Boolean InvokeCanCalibrateUPP(CMDisplayIDType displayID, Str255 errMessage, CanCalibrateUPP userUPP) { return (Boolean)CALL_TWO_PARAMETER_UPP(userUPP, uppCanCalibrateProcInfo, displayID, errMessage); }
#else
#define InvokeCanCalibrateUPP(displayID, errMessage, userUPP) (Boolean)CALL_TWO_PARAMETER_UPP((userUPP), uppCanCalibrateProcInfo, (displayID), (errMessage))
#endif
#endif
/*
* InvokeCalibrateUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: not available
*/
EXTERN_API_C( OSErr )
InvokeCalibrateUPP(
CalibratorInfo * theInfo,
CalibrateUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline OSErr InvokeCalibrateUPP(CalibratorInfo * theInfo, CalibrateUPP userUPP) { return (OSErr)CALL_ONE_PARAMETER_UPP(userUPP, uppCalibrateProcInfo, theInfo); }
#else
#define InvokeCalibrateUPP(theInfo, userUPP) (OSErr)CALL_ONE_PARAMETER_UPP((userUPP), uppCalibrateProcInfo, (theInfo))
#endif
#endif
#if CALL_NOT_IN_CARBON || OLDROUTINENAMES
/* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
#define NewCalibrateEventProc(userRoutine) NewCalibrateEventUPP(userRoutine)
#define NewCanCalibrateProc(userRoutine) NewCanCalibrateUPP(userRoutine)
#define NewCalibrateProc(userRoutine) NewCalibrateUPP(userRoutine)
#define CallCalibrateEventProc(userRoutine, event) InvokeCalibrateEventUPP(event, userRoutine)
#define CallCanCalibrateProc(userRoutine, displayID, errMessage) InvokeCanCalibrateUPP(displayID, errMessage, userRoutine)
#define CallCalibrateProc(userRoutine, theInfo) InvokeCalibrateUPP(theInfo, userRoutine)
#endif /* CALL_NOT_IN_CARBON */
/*
* CMCalibrateDisplay()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: in version 10.0 or later
*/
EXTERN_API( OSErr )
CMCalibrateDisplay(CalibratorInfo * theInfo);
#if OLDROUTINENAMES
/* Interface for original ColorSync monitor calibrators (ColorSync 2.5.x) */
enum {
kOldCalibratorNamePrefix = FOUR_CHAR_CODE('Cali')
};
struct OldCalibratorInfo {
CMDisplayIDType displayID; /* Contains an hDC on Win32 */
CMProfileLocation profileLocation;
CalibrateEventUPP eventProc; /* Ignored on Win32 */
UInt32 reserved; /* Unused */
UInt32 flags; /* Unused */
Boolean isGood; /* true or false */
SInt8 byteFiller; /* Unused */
};
typedef struct OldCalibratorInfo OldCalibratorInfo;
typedef CALLBACK_API( Boolean , OldCanCalibrateProcPtr )(CMDisplayIDType displayID);
typedef CALLBACK_API( OSErr , OldCalibrateProcPtr )(OldCalibratorInfo * theInfo);
typedef STACK_UPP_TYPE(OldCanCalibrateProcPtr) OldCanCalibrateUPP;
typedef STACK_UPP_TYPE(OldCalibrateProcPtr) OldCalibrateUPP;
#if CALL_NOT_IN_CARBON
/*
* NewOldCanCalibrateUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OldCanCalibrateUPP )
NewOldCanCalibrateUPP(OldCanCalibrateProcPtr userRoutine);
#if !OPAQUE_UPP_TYPES
enum { uppOldCanCalibrateProcInfo = 0x000000D0 }; /* pascal 1_byte Func(4_bytes) */
#ifdef __cplusplus
inline OldCanCalibrateUPP NewOldCanCalibrateUPP(OldCanCalibrateProcPtr userRoutine) { return (OldCanCalibrateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppOldCanCalibrateProcInfo, GetCurrentArchitecture()); }
#else
#define NewOldCanCalibrateUPP(userRoutine) (OldCanCalibrateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppOldCanCalibrateProcInfo, GetCurrentArchitecture())
#endif
#endif
/*
* NewOldCalibrateUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OldCalibrateUPP )
NewOldCalibrateUPP(OldCalibrateProcPtr userRoutine);
#if !OPAQUE_UPP_TYPES
enum { uppOldCalibrateProcInfo = 0x000000E0 }; /* pascal 2_bytes Func(4_bytes) */
#ifdef __cplusplus
inline OldCalibrateUPP NewOldCalibrateUPP(OldCalibrateProcPtr userRoutine) { return (OldCalibrateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppOldCalibrateProcInfo, GetCurrentArchitecture()); }
#else
#define NewOldCalibrateUPP(userRoutine) (OldCalibrateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppOldCalibrateProcInfo, GetCurrentArchitecture())
#endif
#endif
/*
* DisposeOldCanCalibrateUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
DisposeOldCanCalibrateUPP(OldCanCalibrateUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline void DisposeOldCanCalibrateUPP(OldCanCalibrateUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
#else
#define DisposeOldCanCalibrateUPP(userUPP) DisposeRoutineDescriptor(userUPP)
#endif
#endif
/*
* DisposeOldCalibrateUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
DisposeOldCalibrateUPP(OldCalibrateUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline void DisposeOldCalibrateUPP(OldCalibrateUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
#else
#define DisposeOldCalibrateUPP(userUPP) DisposeRoutineDescriptor(userUPP)
#endif
#endif
/*
* InvokeOldCanCalibrateUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
InvokeOldCanCalibrateUPP(
CMDisplayIDType displayID,
OldCanCalibrateUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline Boolean InvokeOldCanCalibrateUPP(CMDisplayIDType displayID, OldCanCalibrateUPP userUPP) { return (Boolean)CALL_ONE_PARAMETER_UPP(userUPP, uppOldCanCalibrateProcInfo, displayID); }
#else
#define InvokeOldCanCalibrateUPP(displayID, userUPP) (Boolean)CALL_ONE_PARAMETER_UPP((userUPP), uppOldCanCalibrateProcInfo, (displayID))
#endif
#endif
/*
* InvokeOldCalibrateUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OSErr )
InvokeOldCalibrateUPP(
OldCalibratorInfo * theInfo,
OldCalibrateUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline OSErr InvokeOldCalibrateUPP(OldCalibratorInfo * theInfo, OldCalibrateUPP userUPP) { return (OSErr)CALL_ONE_PARAMETER_UPP(userUPP, uppOldCalibrateProcInfo, theInfo); }
#else
#define InvokeOldCalibrateUPP(theInfo, userUPP) (OSErr)CALL_ONE_PARAMETER_UPP((userUPP), uppOldCalibrateProcInfo, (theInfo))
#endif
#endif
#endif /* CALL_NOT_IN_CARBON */
#if CALL_NOT_IN_CARBON || OLDROUTINENAMES
/* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
#define NewOldCanCalibrateProc(userRoutine) NewOldCanCalibrateUPP(userRoutine)
#define NewOldCalibrateProc(userRoutine) NewOldCalibrateUPP(userRoutine)
#define CallOldCanCalibrateProc(userRoutine, displayID) InvokeOldCanCalibrateUPP(displayID, userRoutine)
#define CallOldCalibrateProc(userRoutine, theInfo) InvokeOldCalibrateUPP(theInfo, userRoutine)
#endif /* CALL_NOT_IN_CARBON */
#endif /* OLDROUTINENAMES */
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#elif PRAGMA_STRUCT_PACKPUSH
#pragma pack(pop)
#elif PRAGMA_STRUCT_PACK
#pragma pack()
#endif
#ifdef PRAGMA_IMPORT_OFF
#pragma import off
#elif PRAGMA_IMPORT
#pragma import reset
#endif
#ifdef __cplusplus
}
#endif
#endif /* __CMCALIBRATOR__ */