Mac OS 9
PictUtils.h
Go to the documentation of this file.
1 
19 #ifndef __PICTUTILS__
20 #define __PICTUTILS__
21 
22 #ifndef __MACTYPES__
23 #include <MacTypes.h>
24 #endif
25 
26 #ifndef __PALETTES__
27 #include <Palettes.h>
28 #endif
29 
30 #if PRAGMA_ONCE
31 #pragma once
32 #endif
33 
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
38 
39 #if PRAGMA_IMPORT
40 #pragma import on
41 #endif
42 
43 #if PRAGMA_STRUCT_ALIGN
44 #pragma options align = mac68k
45 #elif PRAGMA_STRUCT_PACKPUSH
46 #pragma pack(push, 2)
47 #elif PRAGMA_STRUCT_PACK
48 #pragma pack(2)
49 #endif
50 
52  enum
53  {
54  returnColorTable = 0x0001,
55  returnPalette = 0x0002,
56  recordComments = 0x0004,
57  recordFontInfo = 0x0008,
58  suppressBlackAndWhite = 0x0010
59  };
60 
61  enum
62  {
66  medianMethod = 2
67  };
68 
69  enum
70  {
73  ColorBankIsExactAnd555 = 0,
74  ColorBankIs555 = 1
75  };
76 
77  typedef long PictInfoID;
78  struct CommentSpec
79  {
80  short count;
81  short ID;
82  };
83  typedef struct CommentSpec CommentSpec;
84  typedef CommentSpec *CommentSpecPtr;
86  struct FontSpec
87  {
88  short pictFontID;
89  short sysFontID;
90  long size[4];
92  short style;
93  long
95  };
96  typedef struct FontSpec FontSpec;
97  typedef FontSpec *FontSpecPtr;
98  typedef FontSpecPtr *FontSpecHandle;
99  struct PictInfo
100  {
101  short version;
108  short depth;
111  long textCount;
112  long lineCount;
113  long rectCount;
114  long rRectCount;
115  long ovalCount;
116  long arcCount;
117  long polyCount;
118  long regionCount;
119  long bitMapCount;
120  long pixMapCount;
124  long uniqueFonts;
127  long reserved1;
128  long reserved2;
129  };
130  typedef struct PictInfo PictInfo;
131  typedef PictInfo *PictInfoPtr;
132  typedef PictInfoPtr *PictInfoHandle;
133  typedef CALLBACK_API(OSErr, InitPickMethodProcPtr)(SInt16 colorsRequested,
134  UInt32 *dataRef,
135  SInt16 *colorBankType);
136  typedef CALLBACK_API(OSErr, RecordColorsProcPtr)(UInt32 dataRef,
138  SInt32 colorCount,
139  SInt32 *uniqueColors);
140  typedef CALLBACK_API(OSErr, CalcColorTableProcPtr)(UInt32 dataRef,
141  SInt16 colorsRequested,
142  void *colorBankPtr,
143  CSpecArray resultPtr);
144  typedef CALLBACK_API(OSErr, DisposeColorPickMethodProcPtr)(UInt32 dataRef);
145  typedef STACK_UPP_TYPE(InitPickMethodProcPtr) InitPickMethodUPP;
146  typedef STACK_UPP_TYPE(RecordColorsProcPtr) RecordColorsUPP;
147  typedef STACK_UPP_TYPE(CalcColorTableProcPtr) CalcColorTableUPP;
148  typedef STACK_UPP_TYPE(DisposeColorPickMethodProcPtr) DisposeColorPickMethodUPP;
157  InitPickMethodUPP
158  NewInitPickMethodUPP(InitPickMethodProcPtr userRoutine);
159 #if !OPAQUE_UPP_TYPES
160  enum
161  {
162  uppInitPickMethodProcInfo = 0x00000FA0
163  };
164 #ifdef __cplusplus
165  inline InitPickMethodUPP
166  NewInitPickMethodUPP(InitPickMethodProcPtr userRoutine)
167  {
168  return (InitPickMethodUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
169  uppInitPickMethodProcInfo,
170  GetCurrentArchitecture());
171  }
172 #else
173 #define NewInitPickMethodUPP(userRoutine) \
174  (InitPickMethodUPP) \
175  NewRoutineDescriptor((ProcPtr)(userRoutine), uppInitPickMethodProcInfo, \
176  GetCurrentArchitecture())
177 #endif
178 #endif
179 
188  RecordColorsUPP
189  NewRecordColorsUPP(RecordColorsProcPtr userRoutine);
190 #if !OPAQUE_UPP_TYPES
191  enum
192  {
193  uppRecordColorsProcInfo = 0x00003FE0
194  };
195 #ifdef __cplusplus
196  inline RecordColorsUPP NewRecordColorsUPP(RecordColorsProcPtr userRoutine)
197  {
198  return (RecordColorsUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
199  uppRecordColorsProcInfo,
200  GetCurrentArchitecture());
201  }
202 #else
203 #define NewRecordColorsUPP(userRoutine) \
204  (RecordColorsUPP) \
205  NewRoutineDescriptor((ProcPtr)(userRoutine), uppRecordColorsProcInfo, \
206  GetCurrentArchitecture())
207 #endif
208 #endif
209 
218  CalcColorTableUPP
219  NewCalcColorTableUPP(CalcColorTableProcPtr userRoutine);
220 #if !OPAQUE_UPP_TYPES
221  enum
222  {
223  uppCalcColorTableProcInfo = 0x00003EE0
224  };
225 #ifdef __cplusplus
226  inline CalcColorTableUPP
227  NewCalcColorTableUPP(CalcColorTableProcPtr userRoutine)
228  {
229  return (CalcColorTableUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
230  uppCalcColorTableProcInfo,
231  GetCurrentArchitecture());
232  }
233 #else
234 #define NewCalcColorTableUPP(userRoutine) \
235  (CalcColorTableUPP) \
236  NewRoutineDescriptor((ProcPtr)(userRoutine), uppCalcColorTableProcInfo, \
237  GetCurrentArchitecture())
238 #endif
239 #endif
240 
249  DisposeColorPickMethodUPP
250  NewDisposeColorPickMethodUPP(DisposeColorPickMethodProcPtr userRoutine);
251 #if !OPAQUE_UPP_TYPES
252  enum
253  {
254  uppDisposeColorPickMethodProcInfo = 0x000000E0
255  };
256 #ifdef __cplusplus
257  inline DisposeColorPickMethodUPP
258  NewDisposeColorPickMethodUPP(DisposeColorPickMethodProcPtr userRoutine)
259  {
260  return (DisposeColorPickMethodUPP)NewRoutineDescriptor(
261  (ProcPtr)(userRoutine), uppDisposeColorPickMethodProcInfo,
262  GetCurrentArchitecture());
263  }
264 #else
265 #define NewDisposeColorPickMethodUPP(userRoutine) \
266  (DisposeColorPickMethodUPP) NewRoutineDescriptor( \
267  (ProcPtr)(userRoutine), uppDisposeColorPickMethodProcInfo, \
268  GetCurrentArchitecture())
269 #endif
270 #endif
271 
280  void
281  DisposeInitPickMethodUPP(InitPickMethodUPP userUPP);
282 #if !OPAQUE_UPP_TYPES
283 #ifdef __cplusplus
284  inline void DisposeInitPickMethodUPP(InitPickMethodUPP userUPP)
285  {
286  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
287  }
288 #else
289 #define DisposeInitPickMethodUPP(userUPP) DisposeRoutineDescriptor(userUPP)
290 #endif
291 #endif
292 
301  void
302  DisposeRecordColorsUPP(RecordColorsUPP userUPP);
303 #if !OPAQUE_UPP_TYPES
304 #ifdef __cplusplus
305  inline void DisposeRecordColorsUPP(RecordColorsUPP userUPP)
306  {
307  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
308  }
309 #else
310 #define DisposeRecordColorsUPP(userUPP) DisposeRoutineDescriptor(userUPP)
311 #endif
312 #endif
313 
322  void
323  DisposeCalcColorTableUPP(CalcColorTableUPP userUPP);
324 #if !OPAQUE_UPP_TYPES
325 #ifdef __cplusplus
326  inline void DisposeCalcColorTableUPP(CalcColorTableUPP userUPP)
327  {
328  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
329  }
330 #else
331 #define DisposeCalcColorTableUPP(userUPP) DisposeRoutineDescriptor(userUPP)
332 #endif
333 #endif
334 
343  void
344  DisposeDisposeColorPickMethodUPP(DisposeColorPickMethodUPP userUPP);
345 #if !OPAQUE_UPP_TYPES
346 #ifdef __cplusplus
347  inline void
348  DisposeDisposeColorPickMethodUPP(DisposeColorPickMethodUPP userUPP)
349  {
350  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
351  }
352 #else
353 #define DisposeDisposeColorPickMethodUPP(userUPP) \
354  DisposeRoutineDescriptor(userUPP)
355 #endif
356 #endif
357 
366  OSErr
367  InvokeInitPickMethodUPP(SInt16 colorsRequested, UInt32 *dataRef,
368  SInt16 *colorBankType, InitPickMethodUPP userUPP);
369 #if !OPAQUE_UPP_TYPES
370 #ifdef __cplusplus
371  inline OSErr InvokeInitPickMethodUPP(SInt16 colorsRequested, UInt32 *dataRef,
372  SInt16 *colorBankType,
373  InitPickMethodUPP userUPP)
374  {
375  return (OSErr)CALL_THREE_PARAMETER_UPP(userUPP, uppInitPickMethodProcInfo,
376  colorsRequested, dataRef,
377  colorBankType);
378  }
379 #else
380 #define InvokeInitPickMethodUPP(colorsRequested, dataRef, colorBankType, \
381  userUPP) \
382  (OSErr) \
383  CALL_THREE_PARAMETER_UPP((userUPP), uppInitPickMethodProcInfo, \
384  (colorsRequested), (dataRef), (colorBankType))
385 #endif
386 #endif
387 
396  OSErr
397  InvokeRecordColorsUPP(UInt32 dataRef, RGBColor *colorsArray, SInt32 colorCount,
398  SInt32 *uniqueColors, RecordColorsUPP userUPP);
399 #if !OPAQUE_UPP_TYPES
400 #ifdef __cplusplus
401  inline OSErr InvokeRecordColorsUPP(UInt32 dataRef, RGBColor *colorsArray,
402  SInt32 colorCount, SInt32 *uniqueColors,
403  RecordColorsUPP userUPP)
404  {
405  return (OSErr)CALL_FOUR_PARAMETER_UPP(userUPP, uppRecordColorsProcInfo,
406  dataRef, colorsArray, colorCount,
407  uniqueColors);
408  }
409 #else
410 #define InvokeRecordColorsUPP(dataRef, colorsArray, colorCount, uniqueColors, \
411  userUPP) \
412  (OSErr) \
413  CALL_FOUR_PARAMETER_UPP((userUPP), uppRecordColorsProcInfo, (dataRef), \
414  (colorsArray), (colorCount), (uniqueColors))
415 #endif
416 #endif
417 
426  OSErr
427  InvokeCalcColorTableUPP(UInt32 dataRef, SInt16 colorsRequested,
428  void *colorBankPtr, CSpecArray resultPtr,
429  CalcColorTableUPP userUPP);
430 #if !OPAQUE_UPP_TYPES
431 #ifdef __cplusplus
432  inline OSErr InvokeCalcColorTableUPP(UInt32 dataRef, SInt16 colorsRequested,
433  void *colorBankPtr, CSpecArray resultPtr,
434  CalcColorTableUPP userUPP)
435  {
436  return (OSErr)CALL_FOUR_PARAMETER_UPP(userUPP, uppCalcColorTableProcInfo,
437  dataRef, colorsRequested, colorBankPtr,
438  resultPtr);
439  }
440 #else
441 #define InvokeCalcColorTableUPP(dataRef, colorsRequested, colorBankPtr, \
442  resultPtr, userUPP) \
443  (OSErr) \
444  CALL_FOUR_PARAMETER_UPP((userUPP), uppCalcColorTableProcInfo, (dataRef), \
445  (colorsRequested), (colorBankPtr), (resultPtr))
446 #endif
447 #endif
448 
457  OSErr
459  DisposeColorPickMethodUPP userUPP);
460 #if !OPAQUE_UPP_TYPES
461 #ifdef __cplusplus
462  inline OSErr
463  InvokeDisposeColorPickMethodUPP(UInt32 dataRef,
464  DisposeColorPickMethodUPP userUPP)
465  {
466  return (OSErr)CALL_ONE_PARAMETER_UPP(
467  userUPP, uppDisposeColorPickMethodProcInfo, dataRef);
468  }
469 #else
470 #define InvokeDisposeColorPickMethodUPP(dataRef, userUPP) \
471  (OSErr) CALL_ONE_PARAMETER_UPP((userUPP), uppDisposeColorPickMethodProcInfo, \
472  (dataRef))
473 #endif
474 #endif
475 
476 #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
478 #define NewInitPickMethodProc(userRoutine) NewInitPickMethodUPP(userRoutine)
479 #define NewRecordColorsProc(userRoutine) NewRecordColorsUPP(userRoutine)
480 #define NewCalcColorTableProc(userRoutine) NewCalcColorTableUPP(userRoutine)
481 #define NewDisposeColorPickMethodProc(userRoutine) \
482  NewDisposeColorPickMethodUPP(userRoutine)
483 #define CallInitPickMethodProc(userRoutine, colorsRequested, dataRef, \
484  colorBankType) \
485  InvokeInitPickMethodUPP(colorsRequested, dataRef, colorBankType, userRoutine)
486 #define CallRecordColorsProc(userRoutine, dataRef, colorsArray, colorCount, \
487  uniqueColors) \
488  InvokeRecordColorsUPP(dataRef, colorsArray, colorCount, uniqueColors, \
489  userRoutine)
490 #define CallCalcColorTableProc(userRoutine, dataRef, colorsRequested, \
491  colorBankPtr, resultPtr) \
492  InvokeCalcColorTableUPP(dataRef, colorsRequested, colorBankPtr, resultPtr, \
493  userRoutine)
494 #define CallDisposeColorPickMethodProc(userRoutine, dataRef) \
495  InvokeDisposeColorPickMethodUPP(dataRef, userRoutine)
496 #endif
506  OSErr
507  GetPictInfo(PicHandle thePictHandle, PictInfo *thePictInfo, short verb,
508  short colorsRequested, short colorPickMethod, short version);
509 
518  OSErr
519  GetPixMapInfo(PixMapHandle thePixMapHandle, PictInfo *thePictInfo, short verb,
520  short colorsRequested, short colorPickMethod, short version);
521 
530  OSErr
531  NewPictInfo(PictInfoID *thePictInfoID, short verb, short colorsRequested,
532  short colorPickMethod, short version);
533 
542  OSErr
543  RecordPictInfo(PictInfoID thePictInfoID, PicHandle thePictHandle);
544 
553  OSErr
554  RecordPixMapInfo(PictInfoID thePictInfoID, PixMapHandle thePixMapHandle);
555 
564  OSErr
565  RetrievePictInfo(PictInfoID thePictInfoID, PictInfo *thePictInfo,
566  short colorsRequested);
567 
576  OSErr
577  DisposePictInfo(PictInfoID thePictInfoID);
578 
579 #if OLDROUTINENAMES
580 #define DisposPictInfo(thePictInfoID) DisposePictInfo(thePictInfoID)
581 #endif
583 #if PRAGMA_STRUCT_ALIGN
584 #pragma options align = reset
585 #elif PRAGMA_STRUCT_PACKPUSH
586 #pragma pack(pop)
587 #elif PRAGMA_STRUCT_PACK
588 #pragma pack()
589 #endif
590 
591 #ifdef PRAGMA_IMPORT_OFF
592 #pragma import off
593 #elif PRAGMA_IMPORT
594 #pragma import reset
595 #endif
596 
597 #ifdef __cplusplus
598 }
599 #endif
600 
601 #endif
Basic Macintosh data types.
long Fixed
Definition: MacTypes.h:153
void DisposeRoutineDescriptor(UniversalProcPtr theUPP)
#define STACK_UPP_TYPE(name)
Definition: MixedMode.h:734
UniversalProcPtr NewRoutineDescriptor(ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA)
Palette Manager Interfaces.
OSErr RecordPictInfo(PictInfoID thePictInfoID, PicHandle thePictHandle)
OSErr InvokeCalcColorTableUPP(UInt32 dataRef, SInt16 colorsRequested, void *colorBankPtr, CSpecArray resultPtr, CalcColorTableUPP userUPP)
OSErr RecordPixMapInfo(PictInfoID thePictInfoID, PixMapHandle thePixMapHandle)
#define NewRecordColorsUPP(userRoutine)
Definition: PictUtils.h:203
#define NewCalcColorTableUPP(userRoutine)
Definition: PictUtils.h:234
void DisposeRecordColorsUPP(RecordColorsUPP userUPP)
#define NewDisposeColorPickMethodUPP(userRoutine)
Definition: PictUtils.h:265
OSErr InvokeDisposeColorPickMethodUPP(UInt32 dataRef, DisposeColorPickMethodUPP userUPP)
OSErr GetPictInfo(PicHandle thePictHandle, PictInfo *thePictInfo, short verb, short colorsRequested, short colorPickMethod, short version)
OSErr NewPictInfo(PictInfoID *thePictInfoID, short verb, short colorsRequested, short colorPickMethod, short version)
void DisposeDisposeColorPickMethodUPP(DisposeColorPickMethodUPP userUPP)
@ popularMethod
Definition: PictUtils.h:65
@ systemMethod
Definition: PictUtils.h:64
@ medianMethod
Definition: PictUtils.h:66
OSErr DisposePictInfo(PictInfoID thePictInfoID)
OSErr GetPixMapInfo(PixMapHandle thePixMapHandle, PictInfo *thePictInfo, short verb, short colorsRequested, short colorPickMethod, short version)
@ ColorBankIsCustom
Definition: PictUtils.h:72
void DisposeInitPickMethodUPP(InitPickMethodUPP userUPP)
#define NewInitPickMethodUPP(userRoutine)
Definition: PictUtils.h:173
OSErr RetrievePictInfo(PictInfoID thePictInfoID, PictInfo *thePictInfo, short colorsRequested)
OSErr InvokeRecordColorsUPP(UInt32 dataRef, RGBColor *colorsArray, SInt32 colorCount, SInt32 *uniqueColors, RecordColorsUPP userUPP)
OSErr InvokeInitPickMethodUPP(SInt16 colorsRequested, UInt32 *dataRef, SInt16 *colorBankType, InitPickMethodUPP userUPP)
void DisposeCalcColorTableUPP(CalcColorTableUPP userUPP)
Definition: Quickdraw.h:1968
Definition: PictUtils.h:79
short ID
Definition: PictUtils.h:81
Definition: PictUtils.h:87
short sysFontID
Definition: PictUtils.h:89
short style
Definition: PictUtils.h:92
long nameOffset
Definition: PictUtils.h:94
Definition: Palettes.h:82
Definition: PictUtils.h:100
PaletteHandle thePalette
Definition: PictUtils.h:104
short depth
Definition: PictUtils.h:108
FontSpecHandle fontHandle
Definition: PictUtils.h:125
long pixMapCount
Definition: PictUtils.h:120
long polyCount
Definition: PictUtils.h:117
long rectCount
Definition: PictUtils.h:113
long uniqueFonts
Definition: PictUtils.h:124
Fixed hRes
Definition: PictUtils.h:106
long uniqueComments
Definition: PictUtils.h:122
long ovalCount
Definition: PictUtils.h:115
long commentCount
Definition: PictUtils.h:121
CommentSpecHandle commentHandle
Definition: PictUtils.h:123
long bitMapCount
Definition: PictUtils.h:119
long regionCount
Definition: PictUtils.h:118
CTabHandle theColorTable
Definition: PictUtils.h:105
long rRectCount
Definition: PictUtils.h:114
long reserved1
Definition: PictUtils.h:127
Handle fontNamesHandle
Definition: PictUtils.h:126
long textCount
Definition: PictUtils.h:111
Rect sourceRect
Definition: PictUtils.h:109
Fixed vRes
Definition: PictUtils.h:107
long arcCount
Definition: PictUtils.h:116
long lineCount
Definition: PictUtils.h:112
long uniqueColors
Definition: PictUtils.h:102
Definition: Quickdraw.h:326
Definition: Quickdraw.h:2064
Definition: Quickdraw.h:1710
Definition: MacTypes.h:527