~ubuntu-branches/ubuntu/lucid/fpc/lucid-proposed

« back to all changes in this revision

Viewing changes to fpcsrc/packages/univint/src/QDPictToCGContext.pas

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-10-09 23:29:00 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20081009232900-553f61m37jkp6upv
Tags: 2.2.2-4
[ Torsten Werner ]
* Update ABI version in fpc-depends automatically.
* Remove empty directories from binary package fpc-source.

[ Mazen Neifer ]
* Removed leading path when calling update-alternatives to remove a Linitian
  error.
* Fixed clean target.
* Improved description of packages. (Closes: #498882)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
     File:       QD/QDPictToCGContext.h
 
3
 
 
4
     Contains:   API to draw Quickdraw PICTs into CoreGraphics context
 
5
 
 
6
     Version:    Quickdraw-150~1
 
7
 
 
8
     Copyright:  � 2001-2003 by Apple Computer, Inc., all rights reserved.
 
9
 
 
10
     Bugs?:      For bug reports, consult the following page on
 
11
                 the World Wide Web:
 
12
 
 
13
                     http://www.freepascal.org/bugs.html
 
14
 
 
15
}
 
16
{         Pascal Translation:  Peter N Lewis, <peter@stairways.com.au>, 2004 }
 
17
 
 
18
 
 
19
{
 
20
    Modified for use with Free Pascal
 
21
    Version 210
 
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 QDPictToCGContext;
 
32
interface
 
33
{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
 
34
{$setc GAP_INTERFACES_VERSION := $0210}
 
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,CGContext,CGGeometry,CGDataProvider,CFURL;
 
108
{$ALIGN MAC68K}
 
109
 
 
110
type
 
111
        QDPictRef    = ^SInt32; { an opaque 32-bit type }
 
112
 
 
113
{
 
114
    Note: QuickDraw picture data typically comes in two forms: a PICT resource
 
115
    that begins the picture header data at the beginning of the resource and PICT
 
116
    files that begin with 512 bytes of arbitrary data, followed by
 
117
    the picture header data. For this reason, the routines that create a QDPictRef
 
118
    attempt to find the picture header data beginning at either the first byte
 
119
    of the data provided or at byte 513 of the data provided.
 
120
    
 
121
    Additionally the Picture Bounds must not be an empty rect.
 
122
}
 
123
{ Create a QDPict reference, using `provider' to obtain the QDPict's data. 
 
124
 * It is assumed that either the first byte or the 513th byte of data
 
125
 * in the file referenced by the URL is the first byte of the
 
126
 * picture header. If the URL does not begin PICT data at one
 
127
 * of these places in the data fork then the QDPictRef returned will be NULL.
 
128
}
 
129
{
 
130
 *  QDPictCreateWithProvider()
 
131
 *  
 
132
 *  Availability:
 
133
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 
134
 *    CarbonLib:        not available
 
135
 *    Non-Carbon CFM:   not available
 
136
 }
 
137
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
 
138
function QDPictCreateWithProvider( provider: CGDataProviderRef ): QDPictRef; external name '_QDPictCreateWithProvider';
 
139
 
 
140
 
 
141
{ Create a QDPict reference from `url'. 
 
142
 * It is assumed that either the first byte or the 513th byte of data
 
143
 * in the file referenced by the URL is the first byte of the
 
144
 * picture header. If the URL does not begin PICT data at one
 
145
 * of these places in the data fork then the QDPictRef returned will be NULL.
 
146
}
 
147
{
 
148
 *  QDPictCreateWithURL()
 
149
 *  
 
150
 *  Availability:
 
151
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 
152
 *    CarbonLib:        not available
 
153
 *    Non-Carbon CFM:   not available
 
154
 }
 
155
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
 
156
function QDPictCreateWithURL( url: CFURLRef ): QDPictRef; external name '_QDPictCreateWithURL';
 
157
 
 
158
 
 
159
{ Increment the retain count of `pictRef' and return it.  All 
 
160
 * pictRefs are created with an initial retain count of 1. }
 
161
{
 
162
 *  QDPictRetain()
 
163
 *  
 
164
 *  Availability:
 
165
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 
166
 *    CarbonLib:        not available
 
167
 *    Non-Carbon CFM:   not available
 
168
 }
 
169
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
 
170
function QDPictRetain( pictRef: QDPictRef ): QDPictRef; external name '_QDPictRetain';
 
171
 
 
172
 
 
173
{ Decrement the retain count of `pictRef'.  If the retain count reaches 0,
 
174
 * then free it and any associated resources. }
 
175
{
 
176
 *  QDPictRelease()
 
177
 *  
 
178
 *  Availability:
 
179
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 
180
 *    CarbonLib:        not available
 
181
 *    Non-Carbon CFM:   not available
 
182
 }
 
183
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
 
184
procedure QDPictRelease( pictRef: QDPictRef ); external name '_QDPictRelease';
 
185
 
 
186
 
 
187
{ Return the Picture Bounds of the QuickDraw picture represented by `pictRef'. This
 
188
    rectangle is in the default user space with one unit = 1/72 inch.
 
189
}
 
190
{
 
191
 *  QDPictGetBounds()
 
192
 *  
 
193
 *  Availability:
 
194
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 
195
 *    CarbonLib:        not available
 
196
 *    Non-Carbon CFM:   not available
 
197
 }
 
198
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
 
199
function QDPictGetBounds( pictRef: QDPictRef ): CGRect; external name '_QDPictGetBounds';
 
200
 
 
201
 
 
202
{ Return the resolution of the QuickDraw picture represented by `pictRef'.
 
203
    This data, together with the CGRect returned by QDPictGetBounds, can be
 
204
    used to compute the size of the picture in pixels, which is what QuickDraw
 
205
    really records into pictures.
 
206
}
 
207
{
 
208
 *  QDPictGetResolution()
 
209
 *  
 
210
 *  Availability:
 
211
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 
212
 *    CarbonLib:        not available
 
213
 *    Non-Carbon CFM:   not available
 
214
 }
 
215
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
 
216
procedure QDPictGetResolution( pictRef: QDPictRef; var xRes, yRes: Float32 ); external name '_QDPictGetResolution';
 
217
 
 
218
 
 
219
{ Draw `pictRef' in the rectangular area specified by `rect'.
 
220
 * The PICT bounds of the page is scaled, if necessary, to fit into
 
221
 * `rect'. To get unscaled results, supply a rect the size of the rect
 
222
 * returned by QDPictGetBounds.
 
223
}
 
224
{
 
225
 *  QDPictDrawToCGContext()
 
226
 *  
 
227
 *  Availability:
 
228
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 
229
 *    CarbonLib:        not available
 
230
 *    Non-Carbon CFM:   not available
 
231
 }
 
232
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
 
233
function QDPictDrawToCGContext( ctx: CGContextRef; rect: CGRect; pictRef: QDPictRef ): OSStatus; external name '_QDPictDrawToCGContext';
 
234
 
 
235
end.