1 { CoreGraphics - CGGeometry.h
2    Copyright (c) 1998-2011 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 CGGeometry;
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,CFDictionary,CGBase;
208 {$endc} {not MACOSALLINCLUDE}
209 
210 {$ALIGN POWER}
211 
212 
213 { Points. }
214 
215 type
216 	CGPointPtr = ^CGPoint;
217 	CGPoint = record
218 		x: CGFloat;
219 		y: CGFloat;
220 	end;
221 
222 { Sizes. }
223 
224 type
225 	CGSizePtr = ^CGSize;
226 	CGSize = record
227 		width: CGFloat;
228 		height: CGFloat;
229 	end;
230 
231 { Vectors. }
232 
233 const
234 	CGVECTOR_DEFINED = 1;
235 
236 type
237   CGVectorPtr = ^CGVector;
238 	CGVector = record
239 		dx: CGFloat;
240 		dy: CGFloat;
241 	end;
242 
243 { Rectangles. }
244 
245 type
246 	CGRectPtr = ^CGRect;
247 	CGRect = record
248 		origin: CGPoint;
249 		size: CGSize;
250 	end;
251 
252 { Rectangle edges. }
253 
254 type
255 	CGRectEdge = SInt32;
256 const
257 	CGRectMinXEdge = 0;
258 	CGRectMinYEdge = 1;
259 	CGRectMaxXEdge = 2;
260 	CGRectMaxYEdge = 3;
261 
262 { The "zero" point -- equivalent to CGPointMake(0, 0). }
263 
264 var CGPointZero: CGPoint; external name '_CGPointZero'; (* attribute const *)
265 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
266 
267 { The "zero" size -- equivalent to CGSizeMake(0, 0). }
268 
269 var CGSizeZero: CGSize; external name '_CGSizeZero'; (* attribute const *)
270 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
271 
272 { The "zero" rectangle -- equivalent to CGRectMake(0, 0, 0, 0). }
273 
274 var CGRectZero: CGRect; external name '_CGRectZero'; (* attribute const *)
275 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
276 
277 { The "empty" rect. This is the rectangle returned when, for example, we
278    intersect two disjoint rectangles. Note that the null rect is not the
279    same as the zero rect. }
280 
281 var CGRectNull: CGRect; external name '_CGRectNull'; (* attribute const *)
282 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
283 
284 { The infinite rectangle. }
285 
286 var CGRectInfinite: CGRect; external name '_CGRectInfinite'; (* attribute const *)
287 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
288 
289 { Return the leftmost x-value of `rect'. }
290 
CGRectGetMinXnull291 function CGRectGetMinX( rect: CGRect ): CGFloat; external name '_CGRectGetMinX';
292 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
293 
294 { Return the midpoint x-value of `rect'. }
295 
CGRectGetMidXnull296 function CGRectGetMidX( rect: CGRect ): CGFloat; external name '_CGRectGetMidX';
297 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
298 
299 { Return the rightmost x-value of `rect'. }
300 
CGRectGetMaxXnull301 function CGRectGetMaxX( rect: CGRect ): CGFloat; external name '_CGRectGetMaxX';
302 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
303 
304 { Return the bottommost y-value of `rect'. }
305 
CGRectGetMinYnull306 function CGRectGetMinY( rect: CGRect ): CGFloat; external name '_CGRectGetMinY';
307 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
308 
309 { Return the midpoint y-value of `rect'. }
310 
CGRectGetMidYnull311 function CGRectGetMidY( rect: CGRect ): CGFloat; external name '_CGRectGetMidY';
312 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
313 
314 { Return the topmost y-value of `rect'. }
315 
CGRectGetMaxYnull316 function CGRectGetMaxY( rect: CGRect ): CGFloat; external name '_CGRectGetMaxY';
317 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
318 
319 { Return the width of `rect'. }
320 
CGRectGetWidthnull321 function CGRectGetWidth( rect: CGRect ): CGFloat; external name '_CGRectGetWidth';
322 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
323 
324 { Return the height of `rect'. }
325 
CGRectGetHeightnull326 function CGRectGetHeight( rect: CGRect ): CGFloat; external name '_CGRectGetHeight';
327 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
328 
329 
330 
331 { Return true if `rect1' and `rect2' are the same, false otherwise. }
332 
CGRectEqualToRectnull333 function CGRectEqualToRect( rect1: CGRect; rect2: CGRect ): CBool; external name '_CGRectEqualToRect';
334 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
335 
336 { Standardize `rect' -- i.e., convert it to an equivalent rect which has
337    positive width and height. }
338 
CGRectStandardizenull339 function CGRectStandardize( rect: CGRect ): CGRect; external name '_CGRectStandardize';
340 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
341 
342 { Return true if `rect' is empty (that is, if it has zero width or height),
343    false otherwise. A null rect is defined to be empty. }
344 
CGRectIsEmptynull345 function CGRectIsEmpty( rect: CGRect ): CBool; external name '_CGRectIsEmpty';
346 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
347 
348 { Return true if `rect' is the null rectangle, false otherwise. }
349 
CGRectIsNullnull350 function CGRectIsNull( rect: CGRect ): CBool; external name '_CGRectIsNull';
351 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
352 
353 { Return true if `rect' is the infinite rectangle, false otherwise. }
354 
CGRectIsInfinitenull355 function CGRectIsInfinite( rect: CGRect ): CBool; external name '_CGRectIsInfinite';
356 (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
357 
358 { Inset `rect' by `(dx, dy)' -- i.e., offset its origin by `(dx, dy)', and
359    decrease its size by `(2*dx, 2*dy)'. }
360 
CGRectInsetnull361 function CGRectInset( rect: CGRect; dx: CGFloat; dy: CGFloat ): CGRect; external name '_CGRectInset';
362 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
363 
364 { Expand `rect' to the smallest rect containing it with integral origin and
365    size. }
366 
CGRectIntegralnull367 function CGRectIntegral( rect: CGRect ): CGRect; external name '_CGRectIntegral';
368 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
369 
370 { Return the union of `r1' and `r2'. }
371 
CGRectUnionnull372 function CGRectUnion( r1: CGRect; r2: CGRect ): CGRect; external name '_CGRectUnion';
373 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
374 
375 { Return the intersection of `r1' and `r2'. This may return a null rect. }
376 
CGRectIntersectionnull377 function CGRectIntersection( r1: CGRect; r2: CGRect ): CGRect; external name '_CGRectIntersection';
378 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
379 
380 { Offset `rect' by `(dx, dy)'. }
381 
CGRectOffsetnull382 function CGRectOffset( rect: CGRect; dx: CGFloat; dy: CGFloat ): CGRect; external name '_CGRectOffset';
383 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
384 
385 { Make two new rectangles, `slice' and `remainder', by dividing `rect' with
386    a line that's parallel to one of its sides, specified by `edge' -- either
387    `CGRectMinXEdge', `CGRectMinYEdge', `CGRectMaxXEdge', or
388    `CGRectMaxYEdge'. The size of `slice' is determined by `amount', which
389    measures the distance from the specified edge. }
390 
391 procedure CGRectDivide( rect: CGRect; var slice: CGRect; var remainder: CGRect; amount: CGFloat; edge: CGRectEdge ); external name '_CGRectDivide';
392 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
393 
394 { Return true if `point' is contained in `rect', false otherwise. }
395 
CGRectContainsPointnull396 function CGRectContainsPoint( rect: CGRect; point: CGPoint ): CBool; external name '_CGRectContainsPoint';
397 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
398 
399 { Return true if `rect2' is contained in `rect1', false otherwise. `rect2'
400    is contained in `rect1' if the union of `rect1' and `rect2' is equal to
401    `rect1'. }
402 
CGRectContainsRectnull403 function CGRectContainsRect( rect1: CGRect; rect2: CGRect ): CBool; external name '_CGRectContainsRect';
404 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
405 
406 { Return true if `rect1' intersects `rect2', false otherwise. `rect1'
407    intersects `rect2' if the intersection of `rect1' and `rect2' is not the
408    null rect. }
409 
CGRectIntersectsRectnull410 function CGRectIntersectsRect( rect1: CGRect; rect2: CGRect ): CBool; external name '_CGRectIntersectsRect';
411 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
412 
413 {** Persistent representations. **}
414 
415 { Return a dictionary representation of `point'. }
416 
CGPointCreateDictionaryRepresentationnull417 function CGPointCreateDictionaryRepresentation( point: CGPoint ): CFDictionaryRef; external name '_CGPointCreateDictionaryRepresentation';
418 (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
419 
420 { Make a CGPoint from the contents of `dict' (presumably returned earlier
421    from `CGPointCreateDictionaryRepresentation') and store the value in
422    `point'. Returns true on success; false otherwise. }
423 
CGPointMakeWithDictionaryRepresentationnull424 function CGPointMakeWithDictionaryRepresentation( dict: CFDictionaryRef; var point: { out } CGPoint ): CBool; external name '_CGPointMakeWithDictionaryRepresentation';
425 (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
426 
427 { Return a dictionary representation of `size'. }
428 
CGSizeCreateDictionaryRepresentationnull429 function CGSizeCreateDictionaryRepresentation( size: CGSize ): CFDictionaryRef; external name '_CGSizeCreateDictionaryRepresentation';
430 (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
431 
432 { Make a CGSize from the contents of `dict' (presumably returned earlier
433    from `CGSizeCreateDictionaryRepresentation') and store the value in
434    `size'. Returns true on success; false otherwise. }
435 
CGSizeMakeWithDictionaryRepresentationnull436 function CGSizeMakeWithDictionaryRepresentation( dict: CFDictionaryRef; var size: { out } CGSize ): CBool; external name '_CGSizeMakeWithDictionaryRepresentation';
437 (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
438 
439 { Return a dictionary representation of `rect'. }
440 
CGRectCreateDictionaryRepresentationnull441 function CGRectCreateDictionaryRepresentation( rect: CGRect ): CFDictionaryRef; external name '_CGRectCreateDictionaryRepresentation';
442 (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
443 
444 { Make a CGRect from the contents of `dict' (presumably returned earlier
445    from `CGRectCreateDictionaryRepresentation') and store the value in
446    `rect'. Returns true on success; false otherwise. }
447 
CGRectMakeWithDictionaryRepresentationnull448 function CGRectMakeWithDictionaryRepresentation( dict: CFDictionaryRef; var rect: { out } CGRect ): CBool; external name '_CGRectMakeWithDictionaryRepresentation';
449 (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
450 
451 
452 {** Definitions of inline functions. **}
453 // CG_INLINE CGPoint
CGPointMakenull454 function CGPointMake(x: CGFloat; y: CGFloat): CGPoint; inline;
455 
456 {
457   CGPoint p; p.x = x; p.y = y; return p;
458 }
459 
460 // CG_INLINE CGSize
CGSizeMakenull461 function CGSizeMake(width: CGFloat; height: CGFloat): CGSize; inline;
462 {
463   CGSize size; size.width = width; size.height = height; return size;
464 }
465 // CG_INLINE CGVector
CGVectorMakenull466 function CGVectorMake(dx: CGFloat; dy: CGFloat): CGVector; inline;
467 
468 
469 // CG_INLINE CGRect
470 // seems not useful to inline to me, is fairly big (unless you can reschedule
471 // all the stores among the rest of the code, but still will probably increase
472 // code size in all cases)
CGRectMakenull473 function CGRectMake(x: CGFloat; y: CGFloat; width: CGFloat; height: CGFloat): CGRect;
474 {
475   CGRect rect;
476   rect.origin.x = x; rect.origin.y = y;
477   rect.size.width = width; rect.size.height = height;
478   return rect;
479 }
480 
481 // CG_INLINE bool
CGPointEqualToPointnull482 function CGPointEqualToPoint(const point1: CGPoint; const point2: CGPoint): boolean; inline;
483 {
484   return point1.x == point2.x && point1.y == point2.y;
485 }
486 
487 // CG_INLINE bool
CGSizeEqualToSizenull488 function CGSizeEqualToSize(size1: CGSize; size2: CGSize): boolean; inline;
489 {
490   return size1.width == size2.width && size1.height == size2.height;
491 }
492 
493 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
494 implementation
495 
CGPointMakenull496 function CGPointMake(x: CGFloat; y: CGFloat): CGPoint; inline;
497 begin
498   CGPointMake.x := x;
499   CGPointMake.y := y;
500 end;
501 
502 
CGSizeMakenull503 function CGSizeMake(width: CGFloat; height: CGFloat): CGSize; inline;
504 begin
505   CGSizeMake.width := width;
506   CGSizeMake.height := height;
507 end;
508 
509 
CGVectorMakenull510 function CGVectorMake(dx: CGFloat; dy: CGFloat): CGVector; inline;
511 begin
512   CGVectorMake.dx := dx;
513   CGVectorMake.dy := dy;
514 end;
515 
516 
CGRectMakenull517 function CGRectMake(x: CGFloat; y: CGFloat; width: CGFloat; height: CGFloat): CGRect;
518 begin
519   CGRectMake.origin.x := x;
520   CGRectMake.origin.y := y;
521   CGRectMake.size.width := width;
522   CGRectMake.size.height := height;
523 end;
524 
525 
CGPointEqualToPointnull526 function CGPointEqualToPoint(const point1: CGPoint; const point2: CGPoint): boolean; inline;
527 begin
528   CGPointEqualToPoint:=
529     (point1.x = point2.x) and
530     (point1.y = point2.y);
531 end;
532 
533 
CGSizeEqualToSizenull534 function CGSizeEqualToSize(size1: CGSize; size2: CGSize): boolean; inline;
535 begin
536   CGSizeEqualToSize:=
537     (size1.width = size2.width) and
538     (size1.height = size2.height);
539 end;
540 
541 
542 end.
543 
544 {$endc} {not MACOSALLINCLUDE}
545