1 { CoreGraphics - CGContext.h
2  * Copyright (c) 2000-2008 Apple Inc.
3  * All rights reserved. }
4 {       Pascal Translation Updated:  Peter N Lewis, <peter@stairways.com.au>, August 2005 }
5 {       Pascal Translation Updated:  Jonas Maebe, <jonas@freepascal.org>, October 2009 }
6 {       Pascal Translation Updated:  Jonas Maebe, <jonas@freepascal.org>, October 2012 }
7 {       Pascal Translation Updated:  Jonas Maebe, <jonas@freepascal.org>, October 2015 }
8 {
9     Modified for use with Free Pascal
10     Version 308
11     Please report any bugs to <gpc@microbizz.nl>
12 }
13 
14 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
15 {$mode macpas}
16 {$modeswitch cblocks}
17 {$packenum 1}
18 {$macro on}
19 {$inline on}
20 {$calling mwpascal}
21 
22 unit CGContext;
23 interface
24 {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
25 {$setc GAP_INTERFACES_VERSION := $0308}
26 
27 {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
28     {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
29 {$endc}
30 
31 {$ifc defined CPUPOWERPC and defined CPUI386}
32 	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
33 {$endc}
34 {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
35 	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
36 {$endc}
37 
38 {$ifc not defined __ppc__ and defined CPUPOWERPC32}
39 	{$setc __ppc__ := 1}
40 {$elsec}
41 	{$setc __ppc__ := 0}
42 {$endc}
43 {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
44 	{$setc __ppc64__ := 1}
45 {$elsec}
46 	{$setc __ppc64__ := 0}
47 {$endc}
48 {$ifc not defined __i386__ and defined CPUI386}
49 	{$setc __i386__ := 1}
50 {$elsec}
51 	{$setc __i386__ := 0}
52 {$endc}
53 {$ifc not defined __x86_64__ and defined CPUX86_64}
54 	{$setc __x86_64__ := 1}
55 {$elsec}
56 	{$setc __x86_64__ := 0}
57 {$endc}
58 {$ifc not defined __arm__ and defined CPUARM}
59 	{$setc __arm__ := 1}
60 {$elsec}
61 	{$setc __arm__ := 0}
62 {$endc}
63 {$ifc not defined __arm64__ and defined CPUAARCH64}
64   {$setc __arm64__ := 1}
65 {$elsec}
66   {$setc __arm64__ := 0}
67 {$endc}
68 
69 {$ifc defined cpu64}
70   {$setc __LP64__ := 1}
71 {$elsec}
72   {$setc __LP64__ := 0}
73 {$endc}
74 
75 
76 {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
77 	{$error Conflicting definitions for __ppc__ and __i386__}
78 {$endc}
79 
80 {$ifc defined __ppc__ and __ppc__}
81 	{$setc TARGET_CPU_PPC := TRUE}
82 	{$setc TARGET_CPU_PPC64 := FALSE}
83 	{$setc TARGET_CPU_X86 := FALSE}
84 	{$setc TARGET_CPU_X86_64 := FALSE}
85 	{$setc TARGET_CPU_ARM := FALSE}
86 	{$setc TARGET_CPU_ARM64 := FALSE}
87 	{$setc TARGET_OS_MAC := TRUE}
88 	{$setc TARGET_OS_IPHONE := FALSE}
89 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
90 	{$setc TARGET_OS_EMBEDDED := FALSE}
91 {$elifc defined __ppc64__ and __ppc64__}
92 	{$setc TARGET_CPU_PPC := FALSE}
93 	{$setc TARGET_CPU_PPC64 := TRUE}
94 	{$setc TARGET_CPU_X86 := FALSE}
95 	{$setc TARGET_CPU_X86_64 := FALSE}
96 	{$setc TARGET_CPU_ARM := FALSE}
97 	{$setc TARGET_CPU_ARM64 := FALSE}
98 	{$setc TARGET_OS_MAC := TRUE}
99 	{$setc TARGET_OS_IPHONE := FALSE}
100 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
101 	{$setc TARGET_OS_EMBEDDED := FALSE}
102 {$elifc defined __i386__ and __i386__}
103 	{$setc TARGET_CPU_PPC := FALSE}
104 	{$setc TARGET_CPU_PPC64 := FALSE}
105 	{$setc TARGET_CPU_X86 := TRUE}
106 	{$setc TARGET_CPU_X86_64 := FALSE}
107 	{$setc TARGET_CPU_ARM := FALSE}
108 	{$setc TARGET_CPU_ARM64 := FALSE}
109 {$ifc defined iphonesim}
110  	{$setc TARGET_OS_MAC := FALSE}
111 	{$setc TARGET_OS_IPHONE := TRUE}
112 	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
113 {$elsec}
114 	{$setc TARGET_OS_MAC := TRUE}
115 	{$setc TARGET_OS_IPHONE := FALSE}
116 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
117 {$endc}
118 	{$setc TARGET_OS_EMBEDDED := FALSE}
119 {$elifc defined __x86_64__ and __x86_64__}
120 	{$setc TARGET_CPU_PPC := FALSE}
121 	{$setc TARGET_CPU_PPC64 := FALSE}
122 	{$setc TARGET_CPU_X86 := FALSE}
123 	{$setc TARGET_CPU_X86_64 := TRUE}
124 	{$setc TARGET_CPU_ARM := FALSE}
125 	{$setc TARGET_CPU_ARM64 := FALSE}
126 {$ifc defined iphonesim}
127  	{$setc TARGET_OS_MAC := FALSE}
128 	{$setc TARGET_OS_IPHONE := TRUE}
129 	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
130 {$elsec}
131 	{$setc TARGET_OS_MAC := TRUE}
132 	{$setc TARGET_OS_IPHONE := FALSE}
133 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
134 {$endc}
135 	{$setc TARGET_OS_EMBEDDED := FALSE}
136 {$elifc defined __arm__ and __arm__}
137 	{$setc TARGET_CPU_PPC := FALSE}
138 	{$setc TARGET_CPU_PPC64 := FALSE}
139 	{$setc TARGET_CPU_X86 := FALSE}
140 	{$setc TARGET_CPU_X86_64 := FALSE}
141 	{$setc TARGET_CPU_ARM := TRUE}
142 	{$setc TARGET_CPU_ARM64 := FALSE}
143 	{$setc TARGET_OS_MAC := FALSE}
144 	{$setc TARGET_OS_IPHONE := TRUE}
145 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
146 	{$setc TARGET_OS_EMBEDDED := TRUE}
147 {$elifc defined __arm64__ and __arm64__}
148 	{$setc TARGET_CPU_PPC := FALSE}
149 	{$setc TARGET_CPU_PPC64 := FALSE}
150 	{$setc TARGET_CPU_X86 := FALSE}
151 	{$setc TARGET_CPU_X86_64 := FALSE}
152 	{$setc TARGET_CPU_ARM := FALSE}
153 	{$setc TARGET_CPU_ARM64 := TRUE}
154 {$ifc defined ios}
155 	{$setc TARGET_OS_MAC := FALSE}
156 	{$setc TARGET_OS_IPHONE := TRUE}
157 	{$setc TARGET_OS_EMBEDDED := TRUE}
158 {$elsec}
159 	{$setc TARGET_OS_MAC := TRUE}
160 	{$setc TARGET_OS_IPHONE := FALSE}
161 	{$setc TARGET_OS_EMBEDDED := FALSE}
162 {$endc}
163 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
164 {$elsec}
165 	{$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
166 {$endc}
167 
168 {$ifc defined __LP64__ and __LP64__ }
169   {$setc TARGET_CPU_64 := TRUE}
170 {$elsec}
171   {$setc TARGET_CPU_64 := FALSE}
172 {$endc}
173 
174 {$ifc defined FPC_BIG_ENDIAN}
175 	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
176 	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
177 {$elifc defined FPC_LITTLE_ENDIAN}
178 	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
179 	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
180 {$elsec}
181 	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
182 {$endc}
183 {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
184 {$setc CALL_NOT_IN_CARBON := FALSE}
185 {$setc OLDROUTINENAMES := FALSE}
186 {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
187 {$setc OPAQUE_UPP_TYPES := TRUE}
188 {$setc OTCARBONAPPLICATION := TRUE}
189 {$setc OTKERNEL := FALSE}
190 {$setc PM_USE_SESSION_APIS := TRUE}
191 {$setc TARGET_API_MAC_CARBON := TRUE}
192 {$setc TARGET_API_MAC_OS8 := FALSE}
193 {$setc TARGET_API_MAC_OSX := TRUE}
194 {$setc TARGET_CARBON := TRUE}
195 {$setc TARGET_CPU_68K := FALSE}
196 {$setc TARGET_CPU_MIPS := FALSE}
197 {$setc TARGET_CPU_SPARC := FALSE}
198 {$setc TARGET_OS_UNIX := FALSE}
199 {$setc TARGET_OS_WIN32 := FALSE}
200 {$setc TARGET_RT_MAC_68881 := FALSE}
201 {$setc TARGET_RT_MAC_CFM := FALSE}
202 {$setc TARGET_RT_MAC_MACHO := TRUE}
203 {$setc TYPED_FUNCTION_POINTERS := TRUE}
204 {$setc TYPE_BOOL := FALSE}
205 {$setc TYPE_EXTENDED := FALSE}
206 {$setc TYPE_LONGLONG := TRUE}
207 uses MacTypes,CFBase,CGGeometry,CGBase,CFDictionary,CGAffineTransforms,CGColorSpace,CGFont,CGGradient,CGImage,CGPDFDocument,CGPath,CGColor,CGShading,CGPDFPage;
208 {$endc} {not MACOSALLINCLUDE}
209 
210 {$ALIGN POWER}
211 
212 
213 type
214 	CGContextRef = ^OpaqueCGContextRef; { an opaque type }
215 	OpaqueCGContextRef = record end;
216 
217 
218 { Drawing modes for paths. }
219 
220 type
221 	CGPathDrawingMode = SInt32;
222 const
223 	kCGPathFill = 0;
224 	kCGPathEOFill = 1;
225 	kCGPathStroke = 2;
226 	kCGPathFillStroke = 3;
227 	kCGPathEOFillStroke = 4;
228 
229 { Drawing modes for text. }
230 
231 type
232 	CGTextDrawingMode = SInt32;
233 const
234 	kCGTextFill = 0;
235 	kCGTextStroke = 1;
236 	kCGTextFillStroke = 2;
237 	kCGTextInvisible = 3;
238 	kCGTextFillClip = 4;
239 	kCGTextStrokeClip = 5;
240 	kCGTextFillStrokeClip = 6;
241 	kCGTextClip = 7;
242 
243 { Text encodings. }
244 
245 type
246 	CGTextEncoding = SInt32;
247 const
248 	kCGEncodingFontSpecific = 0;
249 	kCGEncodingMacRoman = 1;
250 
251 { Interpolation quality. }
252 
253 type
254 	CGInterpolationQuality = SInt32;
255 const
256 	kCGInterpolationDefault = 0;	{ Let the context decide. }
257 	kCGInterpolationNone = 1;		{ Never interpolate. }
258 	kCGInterpolationLow = 2;		{ Low quality, fast interpolation. }
259 	kCGInterpolationMedium = 4;		{ Medium quality, slower than kCGInterpolationLow. Available in Mac OS X 10.6 & later. }
260 	kCGInterpolationHigh = 3;		{ Highest quality, slower than kCGInterpolationMedium. }
261 
262 { Blend modes.
263 
264    The blend modes from kCGBlendModeNormal to kCGBlendModeLuminosity are
265    supported in Mac OS X 10.4 and later. The Porter-Duff blend modes (from
266    kCGBlendModeClear to kCGBlendModePlusLighter) are supported in Mac OS X
267    10.5 and later. The names of the Porter-Duff blend modes are historical.
268 
269    Note that the Porter-Duff blend modes are not necessarily supported in
270    every context. In particular, they are only guaranteed to work in
271    bitmap-based contexts, such as those created by CGBitmapContextCreate. It
272    is your responsibility to make sure that they do what you want when you
273    use them in a CGContext. }
274 
275 type
276 	CGBlendMode = SInt32;
277 const
278 { Available in Mac OS X 10.4 & later. }
279 	kCGBlendModeNormal = 0;
280 	kCGBlendModeMultiply = 1;
281 	kCGBlendModeScreen = 2;
282 	kCGBlendModeOverlay = 3;
283 	kCGBlendModeDarken = 4;
284 	kCGBlendModeLighten = 5;
285 	kCGBlendModeColorDodge = 6;
286 	kCGBlendModeColorBurn = 7;
287 	kCGBlendModeSoftLight = 8;
288 	kCGBlendModeHardLight = 9;
289 	kCGBlendModeDifference = 10;
290 	kCGBlendModeExclusion = 11;
291 	kCGBlendModeHue = 12;
292 	kCGBlendModeSaturation = 13;
293 	kCGBlendModeColor = 14;
294 	kCGBlendModeLuminosity = 15;
295 
296     { Available in Mac OS X 10.5 & later. R, S, and D are, respectively,
297        premultiplied result, source, and destination colors with alpha; Ra,
298        Sa, and Da are the alpha components of these colors.
299 
300        The Porter-Duff "source over" mode is called `kCGBlendModeNormal':
301          R = S + D*(1 - Sa)
302 
303        Note that the Porter-Duff "XOR" mode is only titularly related to the
304        classical bitmap XOR operation (which is unsupported by
305        CoreGraphics). }
306 
307 	kCGBlendModeClear = 16;			{ R = 0 }
308 	kCGBlendModeCopy = 17;			{ R = S }
309 	kCGBlendModeSourceIn = 18;		{ R = S*Da }
310 	kCGBlendModeSourceOut = 19;		{ R = S*(1 - Da) }
311 	kCGBlendModeSourceAtop = 20;		{ R = S*Da + D*(1 - Sa) }
312 	kCGBlendModeDestinationOver = 21;	{ R = S*(1 - Da) + D }
313 	kCGBlendModeDestinationIn = 22;		{ R = D*Sa }
314 	kCGBlendModeDestinationOut = 23;		{ R = D*(1 - Sa) }
315 	kCGBlendModeDestinationAtop = 24;	{ R = S*(1 - Da) + D*Sa }
316 	kCGBlendModeXOR = 25;			{ R = S*(1 - Da) + D*(1 - Sa) }
317 	kCGBlendModePlusDarker = 26;		{ R = MAX(0, (1 - D) + (1 - S)) }
318 	kCGBlendModePlusLighter = 27;		{ R = MIN(1, S + D) } { Available in Mac OS X 10.4 & later. }
319 
320 { Return the CFTypeID for CGContextRefs. }
321 
CGContextGetTypeIDnull322 function CGContextGetTypeID: CFTypeID; external name '_CGContextGetTypeID';
323 (* CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0) *)
324 
325 {* Graphics state functions. *}
326 
327 { Push a copy of the current graphics state onto the graphics state stack.
328    Note that the path is not considered part of the graphics state, and is
329    not saved. }
330 
331 procedure CGContextSaveGState( c: CGContextRef ); external name '_CGContextSaveGState';
332 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
333 
334 { Restore the current graphics state from the one on the top of the
335    graphics state stack, popping the graphics state stack in the process. }
336 
337 procedure CGContextRestoreGState( c: CGContextRef ); external name '_CGContextRestoreGState';
338 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
339 
340 {* Coordinate space transformations. *}
341 
342 { Scale the current graphics state's transformation matrix (the CTM) by
343    `(sx, sy)'. }
344 
345 procedure CGContextScaleCTM( c: CGContextRef; sx: CGFloat; sy: CGFloat ); external name '_CGContextScaleCTM';
346 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
347 
348 { Translate the current graphics state's transformation matrix (the CTM) by
349    `(tx, ty)'. }
350 
351 procedure CGContextTranslateCTM( c: CGContextRef; tx: CGFloat; ty: CGFloat ); external name '_CGContextTranslateCTM';
352 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
353 
354 { Rotate the current graphics state's transformation matrix (the CTM) by
355    `angle' radians. }
356 
357 procedure CGContextRotateCTM( c: CGContextRef; angle: CGFloat ); external name '_CGContextRotateCTM';
358 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
359 
360 { Concatenate the current graphics state's transformation matrix (the CTM)
361    with the affine transform `transform'. }
362 
363 procedure CGContextConcatCTM( c: CGContextRef; transform: CGAffineTransform ); external name '_CGContextConcatCTM';
364 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
365 
366 { Return the current graphics state's transformation matrix. }
367 
CGContextGetCTMnull368 function CGContextGetCTM( c: CGContextRef ): CGAffineTransform; external name '_CGContextGetCTM';
369 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
370 
371 {* Drawing attribute functions. *}
372 
373 { Set the line width in the current graphics state to `width'. }
374 
375 procedure CGContextSetLineWidth( c: CGContextRef; width: CGFloat ); external name '_CGContextSetLineWidth';
376 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
377 
378 { Set the line cap in the current graphics state to `cap'. }
379 
380 procedure CGContextSetLineCap( c: CGContextRef; cap: CGLineCap ); external name '_CGContextSetLineCap';
381 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
382 
383 { Set the line join in the current graphics state to `join'. }
384 
385 procedure CGContextSetLineJoin( c: CGContextRef; join: CGLineJoin ); external name '_CGContextSetLineJoin';
386 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
387 
388 { Set the miter limit in the current graphics state to `limit'. }
389 
390 procedure CGContextSetMiterLimit( c: CGContextRef; limit: CGFloat ); external name '_CGContextSetMiterLimit';
391 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
392 
393 { Set the line dash patttern in the current graphics state of `c'. }
394 
395 procedure CGContextSetLineDash( c: CGContextRef; phase: CGFloat; {const} lengths: {variable-size-array} CGFloatPtr; count: size_t ); external name '_CGContextSetLineDash';
396 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
397 
398 { Set the path flatness parameter in the current graphics state of `c' to
399    `flatness'. }
400 
401 procedure CGContextSetFlatness( c: CGContextRef; flatness: CGFloat ); external name '_CGContextSetFlatness';
402 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
403 
404 { Set the alpha value in the current graphics state of `c' to `alpha'. }
405 
406 procedure CGContextSetAlpha( c: CGContextRef; alpha: CGFloat ); external name '_CGContextSetAlpha';
407 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
408 
409 { Set the blend mode of `context' to `mode'. }
410 
411 procedure CGContextSetBlendMode( context: CGContextRef; mode: CGBlendMode ); external name '_CGContextSetBlendMode';
412 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
413 
414 {* Path construction functions. *}
415 
416 { Note that a context has a single path in use at any time: a path is not
417    part of the graphics state. }
418 
419 { Begin a new path. The old path is discarded. }
420 
421 procedure CGContextBeginPath( c: CGContextRef ); external name '_CGContextBeginPath';
422 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
423 
424 { Start a new subpath at point `(x, y)' in the context's path. }
425 
426 procedure CGContextMoveToPoint( c: CGContextRef; x: CGFloat; y: CGFloat ); external name '_CGContextMoveToPoint';
427 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
428 
429 { Append a straight line segment from the current point to `(x, y)'. }
430 
431 procedure CGContextAddLineToPoint( c: CGContextRef; x: CGFloat; y: CGFloat ); external name '_CGContextAddLineToPoint';
432 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
433 
434 { Append a cubic Bezier curve from the current point to `(x,y)', with
435    control points `(cp1x, cp1y)' and `(cp2x, cp2y)'. }
436 
437 procedure CGContextAddCurveToPoint( c: CGContextRef; cp1x: CGFloat; cp1y: CGFloat; cp2x: CGFloat; cp2y: CGFloat; x: CGFloat; y: CGFloat ); external name '_CGContextAddCurveToPoint';
438 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
439 
440 { Append a quadratic curve from the current point to `(x, y)', with control
441    point `(cpx, cpy)'. }
442 
443 procedure CGContextAddQuadCurveToPoint( c: CGContextRef; cpx: CGFloat; cpy: CGFloat; x: CGFloat; y: CGFloat ); external name '_CGContextAddQuadCurveToPoint';
444 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
445 
446 { Close the current subpath of the context's path. }
447 
448 procedure CGContextClosePath( c: CGContextRef ); external name '_CGContextClosePath';
449 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
450 
451 {* Path construction convenience functions. *}
452 
453 { Add a single rect to the context's path. }
454 
455 procedure CGContextAddRect( c: CGContextRef; rect: CGRect ); external name '_CGContextAddRect';
456 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
457 
458 { Add a set of rects to the context's path. }
459 
460 procedure CGContextAddRects( c: CGContextRef; {const} rects: {variable-size-array} CGRectPtr; count: size_t ); external name '_CGContextAddRects';
461 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
462 
463 { Add a set of lines to the context's path. }
464 
465 procedure CGContextAddLines( c: CGContextRef; {const} points: {variable-size-array} CGPointPtr; count: size_t ); external name '_CGContextAddLines';
466 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
467 
468 { Add an ellipse inside `rect' to the current path of `context'. See the
469    function `CGPathAddEllipseInRect' for more information on how the path
470    for the ellipse is constructed. }
471 
472 procedure CGContextAddEllipseInRect( context: CGContextRef; rect: CGRect ); external name '_CGContextAddEllipseInRect';
473 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
474 
475 { Add an arc of a circle to the context's path, possibly preceded by a
476    straight line segment. `(x, y)' is the center of the arc; `radius' is its
477    radius; `startAngle' is the angle to the first endpoint of the arc;
478    `endAngle' is the angle to the second endpoint of the arc; and
479    `clockwise' is 1 if the arc is to be drawn clockwise, 0 otherwise.
480    `startAngle' and `endAngle' are measured in radians. }
481 
482 procedure CGContextAddArc( c: CGContextRef; x: CGFloat; y: CGFloat; radius: CGFloat; startAngle: CGFloat; endAngle: CGFloat; clockwise: SInt32 ); external name '_CGContextAddArc';
483 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
484 
485 { Add an arc of a circle to the context's path, possibly preceded by a
486    straight line segment. `radius' is the radius of the arc. The arc is
487    tangent to the line from the current point to `(x1, y1)', and the line
488    from `(x1, y1)' to `(x2, y2)'. }
489 
490 procedure CGContextAddArcToPoint( c: CGContextRef; x1: CGFloat; y1: CGFloat; x2: CGFloat; y2: CGFloat; radius: CGFloat ); external name '_CGContextAddArcToPoint';
491 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
492 
493 { Add `path' to the path of context. The points in `path' are transformed
494    by the CTM of context before they are added. }
495 
496 procedure CGContextAddPath( context: CGContextRef; path: CGPathRef ); external name '_CGContextAddPath';
497 (* CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0) *)
498 
499 {* Path stroking. *}
500 
501 { Replace the path in `context' with the stroked version of the path, using
502    the parameters of `context' to calculate the stroked path. The resulting
503    path is created such that filling it with the appropriate color will
504    produce the same results as stroking the original path. You can use this
505    path in the same way you can use the path of any context; for example,
506    you can clip to the stroked version of a path by calling this function
507    followed by a call to "CGContextClip". }
508 
509 procedure CGContextReplacePathWithStrokedPath( c: CGContextRef ); external name '_CGContextReplacePathWithStrokedPath';
510 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
511 
512 {* Path information functions. *}
513 
514 { Return true if the path of `context' contains no elements, false
515    otherwise. }
516 
CGContextIsPathEmptynull517 function CGContextIsPathEmpty( context: CGContextRef ): CBool; external name '_CGContextIsPathEmpty';
518 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
519 
520 { Return the current point of the current subpath of the path of
521    `context'. }
522 
CGContextGetPathCurrentPointnull523 function CGContextGetPathCurrentPoint( context: CGContextRef ): CGPoint; external name '_CGContextGetPathCurrentPoint';
524 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
525 
526 { Return the bounding box of the path of `context'. The bounding box is the
527    smallest rectangle completely enclosing all points in the path, including
528    control points for Bezier and quadratic curves. }
529 
CGContextGetPathBoundingBoxnull530 function CGContextGetPathBoundingBox( context: CGContextRef ): CGRect; external name '_CGContextGetPathBoundingBox';
531 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
532 
533 { Return a copy of the path of `context'. The returned path is specified in
534    the current user space of `context'. }
535 
CGContextCopyPathnull536 function CGContextCopyPath( context: CGContextRef ): CGPathRef; external name '_CGContextCopyPath';
537 (* CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0) *)
538 
539 { Return true if `point' is contained in the current path of `context'. A
540    point is contained within a context's path if it is inside the painted
541    region when the path is stroked or filled with opaque colors using the
542    path drawing mode `mode'. `point' is specified is user space. }
543 
CGContextPathContainsPointnull544 function CGContextPathContainsPoint( context: CGContextRef; point: CGPoint; mode: CGPathDrawingMode ): CBool; external name '_CGContextPathContainsPoint';
545 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
546 
547 {* Path drawing functions. *}
548 
549 { Draw the context's path using drawing mode `mode'. }
550 
551 procedure CGContextDrawPath( c: CGContextRef; mode: CGPathDrawingMode ); external name '_CGContextDrawPath';
552 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
553 
554 {* Path drawing convenience functions. *}
555 
556 { Fill the context's path using the winding-number fill rule. Any open
557    subpath of the path is implicitly closed. }
558 
559 procedure CGContextFillPath( c: CGContextRef ); external name '_CGContextFillPath';
560 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
561 
562 { Fill the context's path using the even-odd fill rule. Any open subpath of
563    the path is implicitly closed. }
564 
565 procedure CGContextEOFillPath( c: CGContextRef ); external name '_CGContextEOFillPath';
566 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
567 
568 { Stroke the context's path. }
569 
570 procedure CGContextStrokePath( c: CGContextRef ); external name '_CGContextStrokePath';
571 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
572 
573 { Fill `rect' with the current fill color. }
574 
575 procedure CGContextFillRect( c: CGContextRef; rect: CGRect ); external name '_CGContextFillRect';
576 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
577 
578 { Fill `rects', an array of `count' CGRects, with the current fill
579    color. }
580 
581 procedure CGContextFillRects( c: CGContextRef; {const} rects: {variable-size-array} CGRectPtr; count: size_t ); external name '_CGContextFillRects';
582 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
583 
584 { Stroke `rect' with the current stroke color and the current linewidth. }
585 
586 procedure CGContextStrokeRect( c: CGContextRef; rect: CGRect ); external name '_CGContextStrokeRect';
587 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
588 
589 { Stroke `rect' with the current stroke color, using `width' as the the
590    line width. }
591 
592 procedure CGContextStrokeRectWithWidth( c: CGContextRef; rect: CGRect; width: CGFloat ); external name '_CGContextStrokeRectWithWidth';
593 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
594 
595 { Clear `rect' (that is, set the region within the rect to transparent). }
596 
597 procedure CGContextClearRect( c: CGContextRef; rect: CGRect ); external name '_CGContextClearRect';
598 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
599 
600 { Fill an ellipse (an oval) inside `rect'. }
601 
602 procedure CGContextFillEllipseInRect( context: CGContextRef; rect: CGRect ); external name '_CGContextFillEllipseInRect';
603 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
604 
605 { Stroke an ellipse (an oval) inside `rect'. }
606 
607 procedure CGContextStrokeEllipseInRect( context: CGContextRef; rect: CGRect ); external name '_CGContextStrokeEllipseInRect';
608 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
609 
610 { Stroke a sequence of line segments one after another in `context'. The
611    line segments are specified by `points', an array of `count' CGPoints.
612    This function is equivalent to
613 
614      CGContextBeginPath(context);
615      for (k = 0; k < count; k += 2) begin
616          CGContextMoveToPoint(context, s[k].x, s[k].y);
617          CGContextAddLineToPoint(context, s[k+1].x, s[k+1].y);
618      end;
619      CGContextStrokePath(context); }
620 
621 procedure CGContextStrokeLineSegments( c: CGContextRef; {const} points: {variable-size-array} CGPointPtr; count: size_t ); external name '_CGContextStrokeLineSegments';
622 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
623 
624 {* Clipping functions. *}
625 
626 { Intersect the context's path with the current clip path and use the
627    resulting path as the clip path for subsequent rendering operations. Use
628    the winding-number fill rule for deciding what's inside the path. }
629 
630 procedure CGContextClip( c: CGContextRef ); external name '_CGContextClip';
631 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
632 
633 { Intersect the context's path with the current clip path and use the
634    resulting path as the clip path for subsequent rendering operations. Use
635    the even-odd fill rule for deciding what's inside the path. }
636 
637 procedure CGContextEOClip( c: CGContextRef ); external name '_CGContextEOClip';
638 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
639 
640 { Add `mask' transformed to `rect' to the clipping area of `context'. The
641    mask, which may be either an image mask or an image, is mapped into the
642    specified rectangle and intersected with the current clipping area of the
643    context.
644 
645    If `mask' is an image mask, then it clips in a manner identical to the
646    behavior if it were used with "CGContextDrawImage": it indicates an area
647    to be masked out (left unchanged) when drawing. The source samples of the
648    image mask determine which points of the clipping area are changed,
649    acting as an "inverse alpha": if the value of a source sample in the
650    image mask is S, then the corresponding point in the current clipping
651    area will be multiplied by an alpha of (1-S). (For example, if S is 1,
652    then the point in the clipping area becomes clear, while if S is 0, the
653    point in the clipping area is unchanged.
654 
655    If `mask' is an image, then it serves as alpha mask and is blended with
656    the current clipping area. The source samples of mask determine which
657    points of the clipping area are changed: if the value of the source
658    sample in mask is S, then the corresponding point in the current clipping
659    area will be multiplied by an alpha of S. (For example, if S is 0, then
660    the point in the clipping area becomes clear, while if S is 1, the point
661    in the clipping area is unchanged.
662 
663    If `mask' is an image, then it must be in the DeviceGray color space, may
664    not have alpha, and may not be masked by an image mask or masking
665    color. }
666 
667 procedure CGContextClipToMask( c: CGContextRef; rect: CGRect; mask: CGImageRef ); external name '_CGContextClipToMask';
668 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
669 
670 { Return the bounding box of the clip path of `c' in user space. The
671    bounding box is the smallest rectangle completely enclosing all points in
672    the clip. }
673 
CGContextGetClipBoundingBoxnull674 function CGContextGetClipBoundingBox( c: CGContextRef ): CGRect; external name '_CGContextGetClipBoundingBox';
675 (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
676 
677 {* Clipping convenience functions. *}
678 
679 { Intersect the current clipping path with `rect'. Note that this function
680    resets the context's path to the empty path. }
681 
682 procedure CGContextClipToRect( c: CGContextRef; rect: CGRect ); external name '_CGContextClipToRect';
683 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
684 
685 { Intersect the current clipping path with the clipping region formed by
686    creating a path consisting of all rects in `rects'. Note that this
687    function resets the context's path to the empty path. }
688 
689 procedure CGContextClipToRects( c: CGContextRef; {const} rects: {variable-size-array} CGRectPtr; count: size_t ); external name '_CGContextClipToRects';
690 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
691 
692 {* Primitive color functions. *}
693 
694 { Set the current fill color in the context `c' to `color'. }
695 
696 procedure CGContextSetFillColorWithColor( c: CGContextRef; color: CGColorRef ); external name '_CGContextSetFillColorWithColor';
697 (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
698 
699 { Set the current stroke color in the context `c' to `color'. }
700 
701 procedure CGContextSetStrokeColorWithColor( c: CGContextRef; color: CGColorRef ); external name '_CGContextSetStrokeColorWithColor';
702 (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
703 
704 {* Color space functions. *}
705 
706 { Set the current fill color space in `context' to `space'. As a
707    side-effect, set the fill color to a default value appropriate for the
708    color space. }
709 
710 procedure CGContextSetFillColorSpace( context: CGContextRef; space: CGColorSpaceRef ); external name '_CGContextSetFillColorSpace';
711 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
712 
713 { Set the current stroke color space in `context' to `space'. As a
714    side-effect, set the stroke color to a default value appropriate for the
715    color space. }
716 
717 procedure CGContextSetStrokeColorSpace( context: CGContextRef; space: CGColorSpaceRef ); external name '_CGContextSetStrokeColorSpace';
718 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
719 
720 {* Color functions. *}
721 
722 { Set the components of the current fill color in `context' to the values
723    specifed by `components'. The number of elements in `components' must be
724    one greater than the number of components in the current fill color space
725    (N color components + 1 alpha component). The current fill color space
726    must not be a pattern color space. }
727 
728 procedure CGContextSetFillColor( context: CGContextRef; {const} components: {variable-size-array} CGFloatPtr ); external name '_CGContextSetFillColor';
729 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
730 
731 { Set the components of the current stroke color in `context' to the values
732    specifed by `components'. The number of elements in `components' must be
733    one greater than the number of components in the current stroke color
734    space (N color components + 1 alpha component). The current stroke color
735    space must not be a pattern color space. }
736 
737 procedure CGContextSetStrokeColor( context: CGContextRef; {const} components: {variable-size-array} CGFloatPtr ); external name '_CGContextSetStrokeColor';
738 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
739 
740 {* Pattern functions. *}
741 
742 { Set the components of the current fill color in `context' to the values
743    specifed by `components', and set the current fill pattern to `pattern'.
744    The number of elements in `components' must be one greater than the
745    number of components in the current fill color space (N color components
746    + 1 alpha component). The current fill color space must be a pattern
747    color space. }
748 
749 procedure CGContextSetFillPattern( context: CGContextRef; pattern: CGPatternRef; {const} components: {variable-size-array} CGFloatPtr ); external name '_CGContextSetFillPattern';
750 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
751 
752 { Set the components of the current stroke color in `context' to the values
753    specifed by `components', and set the current stroke pattern to
754    `pattern'. The number of elements in `components' must be one greater
755    than the number of components in the current stroke color space (N color
756    components + 1 alpha component). The current stroke color space must be a
757    pattern color space. }
758 
759 procedure CGContextSetStrokePattern( context: CGContextRef; pattern: CGPatternRef; {const} components: {variable-size-array} CGFloatPtr ); external name '_CGContextSetStrokePattern';
760 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
761 
762 { Set the pattern phase in the current graphics state of `context' to
763    `phase'. }
764 
765 procedure CGContextSetPatternPhase( context: CGContextRef; phase: CGSize ); external name '_CGContextSetPatternPhase';
766 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
767 
768 {* Color convenience functions. *}
769 
770 { Set the current fill color space in `context' to `DeviceGray' and set the
771    components of the current fill color to `(gray, alpha)'. }
772 
773 procedure CGContextSetGrayFillColor( context: CGContextRef; gray: CGFloat; alpha: CGFloat ); external name '_CGContextSetGrayFillColor';
774 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
775 
776 { Set the current stroke color space in `context' to `DeviceGray' and set
777    the components of the current stroke color to `(gray, alpha)'. }
778 
779 procedure CGContextSetGrayStrokeColor( context: CGContextRef; gray: CGFloat; alpha: CGFloat ); external name '_CGContextSetGrayStrokeColor';
780 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
781 
782 { Set the current fill color space in `context' to `DeviceRGB' and set the
783    components of the current fill color to `(red, green, blue, alpha)'. }
784 
785 procedure CGContextSetRGBFillColor( context: CGContextRef; red: CGFloat; green: CGFloat; blue: CGFloat; alpha: CGFloat ); external name '_CGContextSetRGBFillColor';
786 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
787 
788 { Set the current stroke color space in `context' to `DeviceRGB' and set
789    the components of the current stroke color to `(red, green, blue,
790    alpha)'. }
791 
792 procedure CGContextSetRGBStrokeColor( context: CGContextRef; red: CGFloat; green: CGFloat; blue: CGFloat; alpha: CGFloat ); external name '_CGContextSetRGBStrokeColor';
793 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
794 
795 { Set the current fill color space in `context' to `DeviceCMYK' and set the
796    components of the current fill color to `(cyan, magenta, yellow, black,
797    alpha)'. }
798 
799 procedure CGContextSetCMYKFillColor( context: CGContextRef; cyan: CGFloat; magenta: CGFloat; yellow: CGFloat; black: CGFloat; alpha: CGFloat ); external name '_CGContextSetCMYKFillColor';
800 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
801 
802 { Set the current stroke color space in `context' to `DeviceCMYK' and set
803    the components of the current stroke color to `(cyan, magenta, yellow,
804    black, alpha)'. }
805 
806 procedure CGContextSetCMYKStrokeColor( context: CGContextRef; cyan: CGFloat; magenta: CGFloat; yellow: CGFloat; black: CGFloat; alpha: CGFloat ); external name '_CGContextSetCMYKStrokeColor';
807 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
808 
809 {* Rendering intent. *}
810 
811 { Set the rendering intent in the current graphics state of `context' to
812    `intent'. }
813 
814 procedure CGContextSetRenderingIntent( context: CGContextRef; intent: CGColorRenderingIntent ); external name '_CGContextSetRenderingIntent';
815 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
816 
817 {* Image functions. *}
818 
819 { Draw `image' in the rectangular area specified by `rect' in the context
820    `c'. The image is scaled, if necessary, to fit into `rect'. }
821 
822 procedure CGContextDrawImage( c: CGContextRef; rect: CGRect; image: CGImageRef ); external name '_CGContextDrawImage';
823 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
824 
825 { Draw `image' tiled in the context `c'. The image is scaled to the size
826    specified by `rect' in user space, positioned at the origin of `rect' in
827    user space, then replicated, stepping the width of `rect' horizontally
828    and the height of `rect' vertically, to fill the current clip region.
829    Unlike patterns, the image is tiled in user space, so transformations
830    applied to the CTM affect the final result. }
831 
832 procedure CGContextDrawTiledImage( c: CGContextRef; rect: CGRect; image: CGImageRef ); external name '_CGContextDrawTiledImage';
833 (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
834 
835 { Return the interpolation quality for image rendering of `context'. The
836    interpolation quality is a gstate parameter which controls the level of
837    interpolation performed when an image is interpolated (for example, when
838    scaling the image). Note that it is merely a hint to the context: not all
839    contexts support all interpolation quality levels. }
840 
CGContextGetInterpolationQualitynull841 function CGContextGetInterpolationQuality( context: CGContextRef ): CGInterpolationQuality; external name '_CGContextGetInterpolationQuality';
842 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
843 
844 { Set the interpolation quality of `context' to `quality'. }
845 
846 procedure CGContextSetInterpolationQuality( context: CGContextRef; quality: CGInterpolationQuality ); external name '_CGContextSetInterpolationQuality';
847 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
848 
849 {* Shadow support. *}
850 
851 { Set the shadow parameters in `context'. `offset' specifies a translation
852    in base-space; `blur' is a non-negative number specifying the amount of
853    blur; `color' specifies the color of the shadow, which may contain a
854    non-opaque alpha value. If `color' is NULL, it's equivalent to specifying
855    a fully transparent color. The shadow is a gstate parameter. After a
856    shadow is specified, all objects drawn subsequently will be shadowed. To
857    turn off shadowing, set the shadow color to a fully transparent color (or
858    pass NULL as the color), or use the standard gsave/grestore mechanism. }
859 
860 procedure CGContextSetShadowWithColor( context: CGContextRef; offset: CGSize; blur: CGFloat; color: CGColorRef ); external name '_CGContextSetShadowWithColor';
861 (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
862 
863 { Equivalent to calling
864      CGContextSetShadowWithColor(context, offset, blur, color)
865    where color is black with 1/3 alpha (i.e., RGBA = (0, 0, 0, 1.0/3.0)) in
866    the DeviceRGB color space. }
867 
868 procedure CGContextSetShadow( context: CGContextRef; offset: CGSize; blur: CGFloat ); external name '_CGContextSetShadow';
869 (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
870 
871 {* Gradient and shading functions. *}
872 
873 { Fill the current clipping region of `context' with a linear gradient from
874    `startPoint' to `endPoint'. The location 0 of `gradient' corresponds to
875    `startPoint'; the location 1 of `gradient' corresponds to `endPoint';
876    colors are linearly interpolated between these two points based on the
877    values of the gradient's locations. The option flags control whether the
878    gradient is drawn before the start point or after the end point. }
879 
880 procedure CGContextDrawLinearGradient( context: CGContextRef; gradient: CGGradientRef; startPoint: CGPoint; endPoint: CGPoint; options: CGGradientDrawingOptions ); external name '_CGContextDrawLinearGradient';
881 (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
882 
883 { Fill the current clipping region of `context' with a radial gradient
884    between two circles defined by the center point and radius of each
885    circle. The location 0 of `gradient' corresponds to a circle centered at
886    `startCenter' with radius `startRadius'; the location 1 of `gradient'
887    corresponds to a circle centered at `endCenter' with radius `endRadius';
888    colors are linearly interpolated between these two circles based on the
889    values of the gradient's locations. The option flags control whether the
890    gradient is drawn before the start circle or after the end circle. }
891 
892 procedure CGContextDrawRadialGradient( context: CGContextRef; gradient: CGGradientRef; startCenter: CGPoint; startRadius: CGFloat; endCenter: CGPoint; endRadius: CGFloat; options: CGGradientDrawingOptions ); external name '_CGContextDrawRadialGradient';
893 (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
894 
895 { Fill the current clipping region of `context' with `shading'. }
896 
897 procedure CGContextDrawShading( context: CGContextRef; shading: CGShadingRef ); external name '_CGContextDrawShading';
898 (* CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0) *)
899 
900 {* Text functions. *}
901 
902 { Set the current character spacing in `context' to `spacing'. The
903    character spacing is added to the displacement between the origin of one
904    character and the origin of the next. }
905 
906 procedure CGContextSetCharacterSpacing( context: CGContextRef; spacing: CGFloat ); external name '_CGContextSetCharacterSpacing';
907 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
908 
909 { Set the user-space point at which text will be drawn in the context `c'
910    to `(x, y)'. }
911 
912 procedure CGContextSetTextPosition( c: CGContextRef; x: CGFloat; y: CGFloat ); external name '_CGContextSetTextPosition';
913 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
914 
915 { Return the user-space point at which text will be drawn in `context'. }
916 
CGContextGetTextPositionnull917 function CGContextGetTextPosition( context: CGContextRef ): CGPoint; external name '_CGContextGetTextPosition';
918 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
919 
920 { Set the text matrix in the context `c' to `t'. }
921 
922 procedure CGContextSetTextMatrix( c: CGContextRef; t: CGAffineTransform ); external name '_CGContextSetTextMatrix';
923 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
924 
925 { Return the text matrix in the context `c'. }
926 
CGContextGetTextMatrixnull927 function CGContextGetTextMatrix( c: CGContextRef ): CGAffineTransform; external name '_CGContextGetTextMatrix';
928 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
929 
930 { Set the text drawing mode in the current graphics state of the context
931    `c' to `mode'. }
932 
933 procedure CGContextSetTextDrawingMode( c: CGContextRef; mode: CGTextDrawingMode ); external name '_CGContextSetTextDrawingMode';
934 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
935 
936 { Set the font in the current graphics state of the context `c' to
937    `font'. }
938 
939 procedure CGContextSetFont( c: CGContextRef; font: CGFontRef ); external name '_CGContextSetFont';
940 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
941 
942 { Set the font size in the current graphics state of the context `c' to
943    `size'. }
944 
945 procedure CGContextSetFontSize( c: CGContextRef; size: CGFloat ); external name '_CGContextSetFontSize';
946 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
947 
948 { Draw `glyphs', an array of `count' CGGlyphs, at the points specified by
949    `positions'. Each element of `positions' specifies the position from the
950    associated glyph; the positions are specified in user space. }
951 
952 procedure CGContextShowGlyphsAtPositions( context: CGContextRef; {const} glyphs: {variable-size-array} CGGlyphPtr; {const} positions: {variable-size-array} CGPointPtr; count: size_t ); external name '_CGContextShowGlyphsAtPositions';
953 (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
954 
955 {* PDF functions. *}
956 
957 { Draw `page' in the current user space of the context `c'. }
958 
959 procedure CGContextDrawPDFPage( c: CGContextRef; page: CGPDFPageRef ); external name '_CGContextDrawPDFPage';
960 (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
961 
962 {* Output page functions. *}
963 
964 { Begin a new page. }
965 
966 procedure CGContextBeginPage( c: CGContextRef; const (*var*) mediaBox: CGRect ); external name '_CGContextBeginPage';
967 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
968 
969 { End the current page. }
970 
971 procedure CGContextEndPage( c: CGContextRef ); external name '_CGContextEndPage';
972 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
973 
974 {* Context functions. *}
975 
976 { Equivalent to `CFRetain(c)'. }
977 
CGContextRetainnull978 function CGContextRetain( c: CGContextRef ): CGContextRef; external name '_CGContextRetain';
979 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
980 
981 { Equivalent to `CFRelease(c)'. }
982 
983 procedure CGContextRelease( c: CGContextRef ); external name '_CGContextRelease';
984 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
985 
986 { Flush all drawing to the destination. }
987 
988 procedure CGContextFlush( c: CGContextRef ); external name '_CGContextFlush';
989 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
990 
991 { Synchronized drawing. }
992 
993 procedure CGContextSynchronize( c: CGContextRef ); external name '_CGContextSynchronize';
994 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
995 
996 {* Antialiasing functions. *}
997 
998 { Turn on antialiasing if `shouldAntialias' is true; turn it off otherwise.
999    This parameter is part of the graphics state. }
1000 
1001 procedure CGContextSetShouldAntialias( context: CGContextRef; shouldAntialias: CBool ); external name '_CGContextSetShouldAntialias';
1002 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
1003 
1004 { Allow antialiasing in `context' if `allowsAntialiasing' is true; don't
1005    allow it otherwise. This parameter is not part of the graphics state. A
1006    context will perform antialiasing if both `allowsAntialiasing' and the
1007    graphics state parameter `shouldAntialias' are true. }
1008 
1009 procedure CGContextSetAllowsAntialiasing( context: CGContextRef; allowsAntialiasing: CBool ); external name '_CGContextSetAllowsAntialiasing';
1010 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
1011 
1012 {* Font display functions. *}
1013 
1014 { Turn on font smoothing if `shouldSmoothFonts' is true; turn it off
1015    otherwise. This parameter is part of the graphics state. Note that this
1016    doesn't guarantee that font smoothing will occur: not all destination
1017    contexts support font smoothing. }
1018 
1019 procedure CGContextSetShouldSmoothFonts( context: CGContextRef; shouldSmoothFonts: CBool ); external name '_CGContextSetShouldSmoothFonts';
1020 (* CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0) *)
1021 
1022 { If `allowsFontSmoothing' is true, then allow font smoothing when
1023    displaying text in `context'; otherwise, don't allow font smoothing. This
1024    parameter is not part of the graphics state. Fonts will be smoothed if
1025    they are antialiased when drawn and if both `allowsFontSmoothing' and the
1026    graphics state parameter `shouldSmoothFonts' are true. }
1027 
1028 procedure CGContextSetAllowsFontSmoothing( context: CGContextRef; allowsFontSmoothing: CBool ); external name '_CGContextSetAllowsFontSmoothing';
1029 (* CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0) *)
1030 
1031 { If `shouldSubpixelPositionFonts' is true, then glyphs may be placed at
1032    subpixel positions (if allowed) when displaying text in `context';
1033    otherwise, glyphs will be forced to integer pixel boundaries. This
1034    parameter is part of the graphics state. }
1035 
1036 procedure CGContextSetShouldSubpixelPositionFonts( context: CGContextRef; shouldSubpixelPositionFonts: CBool ); external name '_CGContextSetShouldSubpixelPositionFonts';
1037 (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
1038 
1039 { If `allowsFontSubpixelPositioning' is true, then allow font subpixel
1040    positioning when displaying text in `context'; otherwise, don't allow
1041    subpixel positioning. This parameter is not part of the graphics state. A
1042    context will place glyphs at subpixel positions if fonts will be
1043    antialiased when drawn and if both `allowsFontSubpixelPositioning' and
1044    the graphics state parameter `shouldSubpixelPositionFonts' are true. }
1045 
1046 procedure CGContextSetAllowsFontSubpixelPositioning( context: CGContextRef; allowsFontSubpixelPositioning: CBool ); external name '_CGContextSetAllowsFontSubpixelPositioning';
1047 (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
1048 
1049 { If `shouldSubpixelQuantizeFonts' is true, then quantize the subpixel
1050    positions of glyphs when displaying text in `context'; otherwise, don't
1051    quantize the subpixel positions. This parameter is part of the graphics
1052    state. }
1053 
1054 procedure CGContextSetShouldSubpixelQuantizeFonts( context: CGContextRef; shouldSubpixelQuantizeFonts: CBool ); external name '_CGContextSetShouldSubpixelQuantizeFonts';
1055 (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
1056 
1057 { If `allowsFontSubpixelQuantization' is true, then allow font subpixel
1058    quantization when displaying text in `context'; otherwise, don't allow
1059    subpixel quantization. This parameter is not part of the graphics state.
1060    A context quantizes subpixel positions if glyphs will be drawn at
1061    subpixel positions and `allowsFontSubpixelQuantization' and the graphics
1062    state parameter `shouldSubpixelQuantizeFonts' are both true. }
1063 
1064 procedure CGContextSetAllowsFontSubpixelQuantization( context: CGContextRef; allowsFontSubpixelQuantization: CBool ); external name '_CGContextSetAllowsFontSubpixelQuantization';
1065 (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
1066 
1067 {* Transparency layer support. *}
1068 
1069 { Begin a transparency layer in `context'. All subsequent drawing
1070    operations until a corresponding `CGContextEndTransparencyLayer' are
1071    composited into a fully transparent backdrop (which is treated as a
1072    separate destination buffer from the context). After the transparency
1073    layer is ended, the result is composited into the context using the
1074    global alpha and shadow state of the context. This operation respects the
1075    clipping region of the context. After a call to this function, all of the
1076    parameters in the graphics state remain unchanged with the exception of
1077    the following:
1078      - The global alpha is set to 1.
1079      - The shadow is turned off.
1080      - The blend mode is set to `kCGBlendModeNormal'.
1081    Ending the transparency layer restores these parameters to the values
1082    they had before `CGContextBeginTransparencyLayer' was called.
1083    Transparency layers may be nested. }
1084 
1085 procedure CGContextBeginTransparencyLayer( context: CGContextRef; auxiliaryInfo: CFDictionaryRef ); external name '_CGContextBeginTransparencyLayer';
1086 (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
1087 
1088 { Begin a transparency layer in `context'. This function is identical to
1089   `CGContextBeginTransparencyLayer' except that the content of the
1090   transparency layer will be bounded by `rect' (specified in user space). }
1091 
1092 procedure CGContextBeginTransparencyLayerWithRect( context: CGContextRef; rect: CGRect; auxiliaryInfo: CFDictionaryRef ); external name '_CGContextBeginTransparencyLayerWithRect';
1093 (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
1094 
1095 { End a tranparency layer. }
1096 
1097 procedure CGContextEndTransparencyLayer( context: CGContextRef ); external name '_CGContextEndTransparencyLayer';
1098 (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
1099 
1100 {* User space to device space tranformations. *}
1101 
1102 { Return the affine transform mapping the user space (abstract coordinates)
1103    of `context' to device space (pixels). }
1104 
CGContextGetUserSpaceToDeviceSpaceTransformnull1105 function CGContextGetUserSpaceToDeviceSpaceTransform( context: CGContextRef ): CGAffineTransform; external name '_CGContextGetUserSpaceToDeviceSpaceTransform';
1106 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
1107 
1108 { Transform `point' from the user space of `context' to device space. }
1109 
CGContextConvertPointToDeviceSpacenull1110 function CGContextConvertPointToDeviceSpace( context: CGContextRef; point: CGPoint ): CGPoint; external name '_CGContextConvertPointToDeviceSpace';
1111 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
1112 
1113 { Transform `point' from device space to the user space of `context'. }
1114 
CGContextConvertPointToUserSpacenull1115 function CGContextConvertPointToUserSpace( context: CGContextRef; point: CGPoint ): CGPoint; external name '_CGContextConvertPointToUserSpace';
1116 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
1117 
1118 { Transform `size' from the user space of `context' to device space. }
1119 
CGContextConvertSizeToDeviceSpacenull1120 function CGContextConvertSizeToDeviceSpace( context: CGContextRef; size: CGSize ): CGSize; external name '_CGContextConvertSizeToDeviceSpace';
1121 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
1122 
1123 { Transform `size' from device space to the user space of `context'. }
1124 
CGContextConvertSizeToUserSpacenull1125 function CGContextConvertSizeToUserSpace( context: CGContextRef; size: CGSize ): CGSize; external name '_CGContextConvertSizeToUserSpace';
1126 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
1127 
1128 { Transform `rect' from the user space of `context' to device space. Since
1129    affine transforms do not preserve rectangles in general, this function
1130    returns the smallest rectangle which contains the transformed corner
1131    points of `rect'. }
1132 
CGContextConvertRectToDeviceSpacenull1133 function CGContextConvertRectToDeviceSpace( context: CGContextRef; rect: CGRect ): CGRect; external name '_CGContextConvertRectToDeviceSpace';
1134 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
1135 
1136 { Transform `rect' from device space to the user space of `context'. Since
1137    affine transforms do not preserve rectangles in general, this function
1138    returns the smallest rectangle which contains the transformed corner
1139    points of `rect'. }
1140 
CGContextConvertRectToUserSpacenull1141 function CGContextConvertRectToUserSpace( context: CGContextRef; rect: CGRect ): CGRect; external name '_CGContextConvertRectToUserSpace';
1142 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
1143 
1144 {* Deprecated functions. *}
1145 
1146 { DEPRECATED; use the CoreText API instead. }
1147 
1148 procedure CGContextSelectFont( c: CGContextRef; name: ConstCStringPtr; size: CGFloat; textEncoding: CGTextEncoding ); external name '_CGContextSelectFont';
1149 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_9, __IPHONE_2_0, __IPHONE_7_0) *)
1150 
1151 { DEPRECATED; use the CoreText API instead. }
1152 
1153 procedure CGContextShowText( c: CGContextRef; strng: ConstCStringPtr; length: size_t ); external name '_CGContextShowText';
1154 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_9, __IPHONE_2_0, __IPHONE_7_0) *)
1155 
1156 { DEPRECATED; use the CoreText API instead. }
1157 
1158 procedure CGContextShowTextAtPoint( c: CGContextRef; x: CGFloat; y: CGFloat; strng: ConstCStringPtr; length: size_t ); external name '_CGContextShowTextAtPoint';
1159 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_9, __IPHONE_2_0, __IPHONE_7_0) *)
1160 
1161 { DEPRECATED; use the CoreText API instead. }
1162 
1163 procedure CGContextShowGlyphs( c: CGContextRef; {const} g: {variable-size-array} CGGlyphPtr; count: size_t ); external name '_CGContextShowGlyphs';
1164 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_9, __IPHONE_2_0, __IPHONE_7_0) *)
1165 
1166 { DEPRECATED; use the CoreText API instead. }
1167 
1168 procedure CGContextShowGlyphsAtPoint( context: CGContextRef; x: CGFloat; y: CGFloat; {const} glyphs: {variable-size-array} CGGlyphPtr; count: size_t ); external name '_CGContextShowGlyphsAtPoint';
1169 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_9, __IPHONE_2_0, __IPHONE_7_0) *)
1170 
1171 { DEPRECATED; use the CoreText API instead. }
1172 
1173 procedure CGContextShowGlyphsWithAdvances( context: CGContextRef; {const} glyphs: {variable-size-array} CGGlyphPtr; {const} advances: {variable-size-array} CGSizePtr; count: size_t ); external name '_CGContextShowGlyphsWithAdvances';
1174 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_3, __MAC_10_9, __IPHONE_2_0, __IPHONE_7_0) *)
1175 
1176 {$ifc TARGET_OS_MAC}
1177 
1178 { DEPRECATED; use the CGPDFPage API instead. }
1179 
1180 procedure CGContextDrawPDFDocument( c: CGContextRef; rect: CGRect; document: CGPDFDocumentRef; page: SInt32 ); external name '_CGContextDrawPDFDocument';
1181 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_5, __IPHONE_NA, __IPHONE_NA) *)
1182 
1183 {$endc}
1184 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
1185 
1186 end.
1187 {$endc} {not MACOSALLINCLUDE}
1188