~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to packages/extra/univint/PictUtils.pas

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
     File:       PictUtils.p
 
3
 
 
4
     Contains:   Picture Utilities Interfaces.
 
5
 
 
6
     Version:    Technology: Mac OS 8.5
 
7
                 Release:    Universal Interfaces 3.4.2
 
8
 
 
9
     Copyright:  � 1990-2002 by Apple Computer, Inc., all rights reserved
 
10
 
 
11
     Bugs?:      For bug reports, consult the following page on
 
12
                 the World Wide Web:
 
13
 
 
14
                     http://www.freepascal.org/bugs.html
 
15
 
 
16
}
 
17
 
 
18
 
 
19
{
 
20
    Modified for use with Free Pascal
 
21
    Version 200
 
22
    Please report any bugs to <gpc@microbizz.nl>
 
23
}
 
24
 
 
25
{$mode macpas}
 
26
{$packenum 1}
 
27
{$macro on}
 
28
{$inline on}
 
29
{$CALLING MWPASCAL}
 
30
 
 
31
unit PictUtils;
 
32
interface
 
33
{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
 
34
{$setc GAP_INTERFACES_VERSION := $0200}
 
35
 
 
36
{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
 
37
    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
 
38
{$endc}
 
39
 
 
40
{$ifc defined CPUPOWERPC and defined CPUI386}
 
41
        {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
 
42
{$endc}
 
43
{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
 
44
        {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
 
45
{$endc}
 
46
 
 
47
{$ifc not defined __ppc__ and defined CPUPOWERPC}
 
48
        {$setc __ppc__ := 1}
 
49
{$elsec}
 
50
        {$setc __ppc__ := 0}
 
51
{$endc}
 
52
{$ifc not defined __i386__ and defined CPUI386}
 
53
        {$setc __i386__ := 1}
 
54
{$elsec}
 
55
        {$setc __i386__ := 0}
 
56
{$endc}
 
57
 
 
58
{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
 
59
        {$error Conflicting definitions for __ppc__ and __i386__}
 
60
{$endc}
 
61
 
 
62
{$ifc defined __ppc__ and __ppc__}
 
63
        {$setc TARGET_CPU_PPC := TRUE}
 
64
        {$setc TARGET_CPU_X86 := FALSE}
 
65
{$elifc defined __i386__ and __i386__}
 
66
        {$setc TARGET_CPU_PPC := FALSE}
 
67
        {$setc TARGET_CPU_X86 := TRUE}
 
68
{$elsec}
 
69
        {$error Neither __ppc__ nor __i386__ is defined.}
 
70
{$endc}
 
71
{$setc TARGET_CPU_PPC_64 := FALSE}
 
72
 
 
73
{$ifc defined FPC_BIG_ENDIAN}
 
74
        {$setc TARGET_RT_BIG_ENDIAN := TRUE}
 
75
        {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
 
76
{$elifc defined FPC_LITTLE_ENDIAN}
 
77
        {$setc TARGET_RT_BIG_ENDIAN := FALSE}
 
78
        {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
 
79
{$elsec}
 
80
        {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
 
81
{$endc}
 
82
{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
 
83
{$setc CALL_NOT_IN_CARBON := FALSE}
 
84
{$setc OLDROUTINENAMES := FALSE}
 
85
{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
 
86
{$setc OPAQUE_UPP_TYPES := TRUE}
 
87
{$setc OTCARBONAPPLICATION := TRUE}
 
88
{$setc OTKERNEL := FALSE}
 
89
{$setc PM_USE_SESSION_APIS := TRUE}
 
90
{$setc TARGET_API_MAC_CARBON := TRUE}
 
91
{$setc TARGET_API_MAC_OS8 := FALSE}
 
92
{$setc TARGET_API_MAC_OSX := TRUE}
 
93
{$setc TARGET_CARBON := TRUE}
 
94
{$setc TARGET_CPU_68K := FALSE}
 
95
{$setc TARGET_CPU_MIPS := FALSE}
 
96
{$setc TARGET_CPU_SPARC := FALSE}
 
97
{$setc TARGET_OS_MAC := TRUE}
 
98
{$setc TARGET_OS_UNIX := FALSE}
 
99
{$setc TARGET_OS_WIN32 := FALSE}
 
100
{$setc TARGET_RT_MAC_68881 := FALSE}
 
101
{$setc TARGET_RT_MAC_CFM := FALSE}
 
102
{$setc TARGET_RT_MAC_MACHO := TRUE}
 
103
{$setc TYPED_FUNCTION_POINTERS := TRUE}
 
104
{$setc TYPE_BOOL := FALSE}
 
105
{$setc TYPE_EXTENDED := FALSE}
 
106
{$setc TYPE_LONGLONG := TRUE}
 
107
uses MacTypes,Quickdraw,Palettes;
 
108
 
 
109
 
 
110
{$ALIGN MAC68K}
 
111
 
 
112
{ verbs for the GetPictInfo, GetPixMapInfo, and NewPictInfo calls }
 
113
 
 
114
const
 
115
        returnColorTable                        = $0001;
 
116
        returnPalette                           = $0002;
 
117
        recordComments                          = $0004;
 
118
        recordFontInfo                          = $0008;
 
119
        suppressBlackAndWhite           = $0010;
 
120
 
 
121
                                                                                                                                {  color pick methods  }
 
122
        systemMethod                            = 0;                                                    {  system color pick method  }
 
123
        popularMethod                           = 1;                                                    {  method that chooses the most popular set of colors  }
 
124
        medianMethod                            = 2;                                                    {  method that chooses a good average mix of colors  }
 
125
 
 
126
                                                                                                                                {  color bank types  }
 
127
        ColorBankIsCustom                       = -1;
 
128
        ColorBankIsExactAnd555          = 0;
 
129
        ColorBankIs555                          = 1;
 
130
 
 
131
 
 
132
type
 
133
        PictInfoID                                                      = SInt32;
 
134
        CommentSpecPtr = ^CommentSpec;
 
135
        CommentSpec = record
 
136
                count:                                  SInt16;                                                         {  number of occurrances of this comment ID  }
 
137
                ID:                                             SInt16;                                                         {  ID for the comment in the picture  }
 
138
        end;
 
139
 
 
140
        CommentSpecHandle                                       = ^CommentSpecPtr;
 
141
        FontSpecPtr = ^FontSpec;
 
142
        FontSpec = record
 
143
                pictFontID:                             SInt16;                                                         {  ID of the font in the picture  }
 
144
                sysFontID:                              SInt16;                                                         {  ID of the same font in the current system file  }
 
145
                size:                                   array [0..3] of SInt32;                         {  bit array of all the sizes found (1..127) (bit 0 means > 127)  }
 
146
                style:                                  SInt16;                                                         {  combined style of all occurrances of the font  }
 
147
                nameOffset:                             SInt32;                                                         {  offset into the fontNamesHdl handle for the font�s name  }
 
148
        end;
 
149
 
 
150
        FontSpecHandle                                          = ^FontSpecPtr;
 
151
        PictInfoPtr = ^PictInfo;
 
152
        PictInfo = record
 
153
                version:                                SInt16;                                                         {  this is always zero, for now  }
 
154
                uniqueColors:                   SInt32;                                                         {  the number of actual colors in the picture(s)/pixmap(s)  }
 
155
                thePalette:                             PaletteHandle;                                                  {  handle to the palette information  }
 
156
                theColorTable:                  CTabHandle;                                                             {  handle to the color table  }
 
157
                hRes:                                   Fixed;                                                                  {  maximum horizontal resolution for all the pixmaps  }
 
158
                vRes:                                   Fixed;                                                                  {  maximum vertical resolution for all the pixmaps  }
 
159
                depth:                                  SInt16;                                                         {  maximum depth for all the pixmaps (in the picture)  }
 
160
                sourceRect:                             Rect;                                                                   {  the picture frame rectangle (this contains the entire picture)  }
 
161
                textCount:                              SInt32;                                                         {  total number of text strings in the picture  }
 
162
                lineCount:                              SInt32;                                                         {  total number of lines in the picture  }
 
163
                rectCount:                              SInt32;                                                         {  total number of rectangles in the picture  }
 
164
                rRectCount:                             SInt32;                                                         {  total number of round rectangles in the picture  }
 
165
                ovalCount:                              SInt32;                                                         {  total number of ovals in the picture  }
 
166
                arcCount:                               SInt32;                                                         {  total number of arcs in the picture  }
 
167
                polyCount:                              SInt32;                                                         {  total number of polygons in the picture  }
 
168
                regionCount:                    SInt32;                                                         {  total number of regions in the picture  }
 
169
                bitMapCount:                    SInt32;                                                         {  total number of bitmaps in the picture  }
 
170
                pixMapCount:                    SInt32;                                                         {  total number of pixmaps in the picture  }
 
171
                commentCount:                   SInt32;                                                         {  total number of comments in the picture  }
 
172
                uniqueComments:                 SInt32;                                                         {  the number of unique comments in the picture  }
 
173
                commentHandle:                  CommentSpecHandle;                                              {  handle to all the comment information  }
 
174
                uniqueFonts:                    SInt32;                                                         {  the number of unique fonts in the picture  }
 
175
                fontHandle:                             FontSpecHandle;                                                 {  handle to the FontSpec information  }
 
176
                fontNamesHandle:                Handle;                                                                 {  handle to the font names  }
 
177
                reserved1:                              SInt32;
 
178
                reserved2:                              SInt32;
 
179
        end;
 
180
 
 
181
        PictInfoHandle                                          = ^PictInfoPtr;
 
182
{$ifc TYPED_FUNCTION_POINTERS}
 
183
        InitPickMethodProcPtr = function(colorsRequested: SInt16; var dataRef: UInt32; var colorBankType: SInt16): OSErr;
 
184
{$elsec}
 
185
        InitPickMethodProcPtr = ProcPtr;
 
186
{$endc}
 
187
 
 
188
{$ifc TYPED_FUNCTION_POINTERS}
 
189
        RecordColorsProcPtr = function(dataRef: UInt32; var colorsArray: RGBColor; colorCount: SInt32; var uniqueColors: SInt32): OSErr;
 
190
{$elsec}
 
191
        RecordColorsProcPtr = ProcPtr;
 
192
{$endc}
 
193
 
 
194
{$ifc TYPED_FUNCTION_POINTERS}
 
195
        CalcColorTableProcPtr = function(dataRef: UInt32; colorsRequested: SInt16; colorBankPtr: UnivPtr; var resultPtr: CSpecArray): OSErr;
 
196
{$elsec}
 
197
        CalcColorTableProcPtr = ProcPtr;
 
198
{$endc}
 
199
 
 
200
{$ifc TYPED_FUNCTION_POINTERS}
 
201
        DisposeColorPickMethodProcPtr = function(dataRef: UInt32): OSErr;
 
202
{$elsec}
 
203
        DisposeColorPickMethodProcPtr = ProcPtr;
 
204
{$endc}
 
205
 
 
206
{$ifc OPAQUE_UPP_TYPES}
 
207
        InitPickMethodUPP = ^SInt32; { an opaque UPP }
 
208
{$elsec}
 
209
        InitPickMethodUPP = UniversalProcPtr;
 
210
{$endc} 
 
211
{$ifc OPAQUE_UPP_TYPES}
 
212
        RecordColorsUPP = ^SInt32; { an opaque UPP }
 
213
{$elsec}
 
214
        RecordColorsUPP = UniversalProcPtr;
 
215
{$endc} 
 
216
{$ifc OPAQUE_UPP_TYPES}
 
217
        CalcColorTableUPP = ^SInt32; { an opaque UPP }
 
218
{$elsec}
 
219
        CalcColorTableUPP = UniversalProcPtr;
 
220
{$endc} 
 
221
{$ifc OPAQUE_UPP_TYPES}
 
222
        DisposeColorPickMethodUPP = ^SInt32; { an opaque UPP }
 
223
{$elsec}
 
224
        DisposeColorPickMethodUPP = UniversalProcPtr;
 
225
{$endc} 
 
226
 
 
227
const
 
228
        uppInitPickMethodProcInfo = $00000FA0;
 
229
        uppRecordColorsProcInfo = $00003FE0;
 
230
        uppCalcColorTableProcInfo = $00003EE0;
 
231
        uppDisposeColorPickMethodProcInfo = $000000E0;
 
232
        {
 
233
         *  NewInitPickMethodUPP()
 
234
         *  
 
235
         *  Availability:
 
236
         *    Non-Carbon CFM:   available as macro/inline
 
237
         *    CarbonLib:        in CarbonLib 1.0 and later
 
238
         *    Mac OS X:         in version 10.0 and later
 
239
                }
 
240
function NewInitPickMethodUPP(userRoutine: InitPickMethodProcPtr): InitPickMethodUPP; external name '_NewInitPickMethodUPP'; { old name was NewInitPickMethodProc }
 
241
{
 
242
 *  NewRecordColorsUPP()
 
243
 *  
 
244
 *  Availability:
 
245
 *    Non-Carbon CFM:   available as macro/inline
 
246
 *    CarbonLib:        in CarbonLib 1.0 and later
 
247
 *    Mac OS X:         in version 10.0 and later
 
248
 }
 
249
function NewRecordColorsUPP(userRoutine: RecordColorsProcPtr): RecordColorsUPP; external name '_NewRecordColorsUPP'; { old name was NewRecordColorsProc }
 
250
{
 
251
 *  NewCalcColorTableUPP()
 
252
 *  
 
253
 *  Availability:
 
254
 *    Non-Carbon CFM:   available as macro/inline
 
255
 *    CarbonLib:        in CarbonLib 1.0 and later
 
256
 *    Mac OS X:         in version 10.0 and later
 
257
 }
 
258
function NewCalcColorTableUPP(userRoutine: CalcColorTableProcPtr): CalcColorTableUPP; external name '_NewCalcColorTableUPP'; { old name was NewCalcColorTableProc }
 
259
{
 
260
 *  NewDisposeColorPickMethodUPP()
 
261
 *  
 
262
 *  Availability:
 
263
 *    Non-Carbon CFM:   available as macro/inline
 
264
 *    CarbonLib:        in CarbonLib 1.0 and later
 
265
 *    Mac OS X:         in version 10.0 and later
 
266
 }
 
267
function NewDisposeColorPickMethodUPP(userRoutine: DisposeColorPickMethodProcPtr): DisposeColorPickMethodUPP; external name '_NewDisposeColorPickMethodUPP'; { old name was NewDisposeColorPickMethodProc }
 
268
{
 
269
 *  DisposeInitPickMethodUPP()
 
270
 *  
 
271
 *  Availability:
 
272
 *    Non-Carbon CFM:   available as macro/inline
 
273
 *    CarbonLib:        in CarbonLib 1.0 and later
 
274
 *    Mac OS X:         in version 10.0 and later
 
275
 }
 
276
procedure DisposeInitPickMethodUPP(userUPP: InitPickMethodUPP); external name '_DisposeInitPickMethodUPP';
 
277
{
 
278
 *  DisposeRecordColorsUPP()
 
279
 *  
 
280
 *  Availability:
 
281
 *    Non-Carbon CFM:   available as macro/inline
 
282
 *    CarbonLib:        in CarbonLib 1.0 and later
 
283
 *    Mac OS X:         in version 10.0 and later
 
284
 }
 
285
procedure DisposeRecordColorsUPP(userUPP: RecordColorsUPP); external name '_DisposeRecordColorsUPP';
 
286
{
 
287
 *  DisposeCalcColorTableUPP()
 
288
 *  
 
289
 *  Availability:
 
290
 *    Non-Carbon CFM:   available as macro/inline
 
291
 *    CarbonLib:        in CarbonLib 1.0 and later
 
292
 *    Mac OS X:         in version 10.0 and later
 
293
 }
 
294
procedure DisposeCalcColorTableUPP(userUPP: CalcColorTableUPP); external name '_DisposeCalcColorTableUPP';
 
295
{
 
296
 *  DisposeDisposeColorPickMethodUPP()
 
297
 *  
 
298
 *  Availability:
 
299
 *    Non-Carbon CFM:   available as macro/inline
 
300
 *    CarbonLib:        in CarbonLib 1.0 and later
 
301
 *    Mac OS X:         in version 10.0 and later
 
302
 }
 
303
procedure DisposeDisposeColorPickMethodUPP(userUPP: DisposeColorPickMethodUPP); external name '_DisposeDisposeColorPickMethodUPP';
 
304
{
 
305
 *  InvokeInitPickMethodUPP()
 
306
 *  
 
307
 *  Availability:
 
308
 *    Non-Carbon CFM:   available as macro/inline
 
309
 *    CarbonLib:        in CarbonLib 1.0 and later
 
310
 *    Mac OS X:         in version 10.0 and later
 
311
 }
 
312
function InvokeInitPickMethodUPP(colorsRequested: SInt16; var dataRef: UInt32; var colorBankType: SInt16; userRoutine: InitPickMethodUPP): OSErr; external name '_InvokeInitPickMethodUPP'; { old name was CallInitPickMethodProc }
 
313
{
 
314
 *  InvokeRecordColorsUPP()
 
315
 *  
 
316
 *  Availability:
 
317
 *    Non-Carbon CFM:   available as macro/inline
 
318
 *    CarbonLib:        in CarbonLib 1.0 and later
 
319
 *    Mac OS X:         in version 10.0 and later
 
320
 }
 
321
function InvokeRecordColorsUPP(dataRef: UInt32; var colorsArray: RGBColor; colorCount: SInt32; var uniqueColors: SInt32; userRoutine: RecordColorsUPP): OSErr; external name '_InvokeRecordColorsUPP'; { old name was CallRecordColorsProc }
 
322
{
 
323
 *  InvokeCalcColorTableUPP()
 
324
 *  
 
325
 *  Availability:
 
326
 *    Non-Carbon CFM:   available as macro/inline
 
327
 *    CarbonLib:        in CarbonLib 1.0 and later
 
328
 *    Mac OS X:         in version 10.0 and later
 
329
 }
 
330
function InvokeCalcColorTableUPP(dataRef: UInt32; colorsRequested: SInt16; colorBankPtr: UnivPtr; var resultPtr: CSpecArray; userRoutine: CalcColorTableUPP): OSErr; external name '_InvokeCalcColorTableUPP'; { old name was CallCalcColorTableProc }
 
331
{
 
332
 *  InvokeDisposeColorPickMethodUPP()
 
333
 *  
 
334
 *  Availability:
 
335
 *    Non-Carbon CFM:   available as macro/inline
 
336
 *    CarbonLib:        in CarbonLib 1.0 and later
 
337
 *    Mac OS X:         in version 10.0 and later
 
338
 }
 
339
function InvokeDisposeColorPickMethodUPP(dataRef: UInt32; userRoutine: DisposeColorPickMethodUPP): OSErr; external name '_InvokeDisposeColorPickMethodUPP'; { old name was CallDisposeColorPickMethodProc }
 
340
{
 
341
 *  GetPictInfo()
 
342
 *  
 
343
 *  Availability:
 
344
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 
345
 *    CarbonLib:        in CarbonLib 1.0 and later
 
346
 *    Mac OS X:         in version 10.0 and later
 
347
 }
 
348
function GetPictInfo(thePictHandle: PicHandle; var thePictInfo: PictInfo; verb: SInt16; colorsRequested: SInt16; colorPickMethod: SInt16; version: SInt16): OSErr; external name '_GetPictInfo';
 
349
{
 
350
 *  GetPixMapInfo()
 
351
 *  
 
352
 *  Availability:
 
353
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 
354
 *    CarbonLib:        in CarbonLib 1.0 and later
 
355
 *    Mac OS X:         in version 10.0 and later
 
356
 }
 
357
function GetPixMapInfo(thePixMapHandle: PixMapHandle; var thePictInfo: PictInfo; verb: SInt16; colorsRequested: SInt16; colorPickMethod: SInt16; version: SInt16): OSErr; external name '_GetPixMapInfo';
 
358
{
 
359
 *  NewPictInfo()
 
360
 *  
 
361
 *  Availability:
 
362
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 
363
 *    CarbonLib:        in CarbonLib 1.0 and later
 
364
 *    Mac OS X:         in version 10.0 and later
 
365
 }
 
366
function NewPictInfo(var thePictInfoID: PictInfoID; verb: SInt16; colorsRequested: SInt16; colorPickMethod: SInt16; version: SInt16): OSErr; external name '_NewPictInfo';
 
367
{
 
368
 *  RecordPictInfo()
 
369
 *  
 
370
 *  Availability:
 
371
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 
372
 *    CarbonLib:        in CarbonLib 1.0 and later
 
373
 *    Mac OS X:         in version 10.0 and later
 
374
 }
 
375
function RecordPictInfo(thePictInfoID: PictInfoID; thePictHandle: PicHandle): OSErr; external name '_RecordPictInfo';
 
376
{
 
377
 *  RecordPixMapInfo()
 
378
 *  
 
379
 *  Availability:
 
380
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 
381
 *    CarbonLib:        in CarbonLib 1.0 and later
 
382
 *    Mac OS X:         in version 10.0 and later
 
383
 }
 
384
function RecordPixMapInfo(thePictInfoID: PictInfoID; thePixMapHandle: PixMapHandle): OSErr; external name '_RecordPixMapInfo';
 
385
{
 
386
 *  RetrievePictInfo()
 
387
 *  
 
388
 *  Availability:
 
389
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 
390
 *    CarbonLib:        in CarbonLib 1.0 and later
 
391
 *    Mac OS X:         in version 10.0 and later
 
392
 }
 
393
function RetrievePictInfo(thePictInfoID: PictInfoID; var thePictInfo: PictInfo; colorsRequested: SInt16): OSErr; external name '_RetrievePictInfo';
 
394
{
 
395
 *  DisposePictInfo()
 
396
 *  
 
397
 *  Availability:
 
398
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 
399
 *    CarbonLib:        in CarbonLib 1.0 and later
 
400
 *    Mac OS X:         in version 10.0 and later
 
401
 }
 
402
function DisposePictInfo(thePictInfoID: PictInfoID): OSErr; external name '_DisposePictInfo';
 
403
{$ifc OLDROUTINENAMES}
 
404
{$ifc CALL_NOT_IN_CARBON}
 
405
{
 
406
 *  DisposPictInfo()
 
407
 *  
 
408
 *  Availability:
 
409
 *    Non-Carbon CFM:   not available
 
410
 *    CarbonLib:        not available
 
411
 *    Mac OS X:         not available
 
412
 }
 
413
function DisposPictInfo(thePictInfoID: PictInfoID): OSErr; external name '_DisposPictInfo';
 
414
{$endc}  {CALL_NOT_IN_CARBON}
 
415
{$endc}  {OLDROUTINENAMES}
 
416
 
 
417
 
 
418
{$ALIGN MAC68K}
 
419
 
 
420
 
 
421
end.