1 { CoreGraphics - CGDirectDisplay.h
2 Copyright (c) 2000-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>, August 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 CGDirectDisplay;
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,CFArray,CFDictionary,CGContext,CGBase,CGGeometry,CGErrors,CGImage;
208 {$endc} {not MACOSALLINCLUDE}
209
210 {$ALIGN POWER}
211
212
213 type
214 CGDirectDisplayID = UInt32;
215 CGDirectDisplayIDPtr = ^CGDirectDisplayID; { when a var xx:CGDirectDisplayID parameter can be nil, it is changed to xx: CGDirectDisplayIDPtr }
216 CGOpenGLDisplayMask = UInt32;
217 CGRefreshRate = Float64;
218
219 type
220 CGDirectPaletteRef = ^OpaqueCGDirectPaletteRef; { an opaque type }
221 OpaqueCGDirectPaletteRef = record end;
222 CGDirectPaletteRefPtr = ^CGDirectPaletteRef; { when a var xx:CGDirectPaletteRef parameter can be nil, it is changed to xx: CGDirectPaletteRefPtr }
223
224 type
225 CGDisplayModeRef = ^OpaqueCGDisplayModeRef; { an opaque type }
226 OpaqueCGDisplayModeRef = record end;
227 CGDisplayModeRefPtr = ^CGDisplayModeRef;
228
229 const
230 kCGNullDirectDisplay = CGDirectDisplayID(0);
231
232 {$ifc TARGET_OS_MAC}
233
234 {GPC-FPC-ONLY-START}
kCGDirectMainDisplaynull235 function kCGDirectMainDisplay: CGDirectDisplayID; external name '_CGMainDisplayID';
236 {GPC-FPC-ONLY-END}
237
238 { Return the display ID of the current main display. }
239
CGMainDisplayIDnull240 function CGMainDisplayID: CGDirectDisplayID; external name '_CGMainDisplayID';
241 (* CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
242
243 { Mechanisms used to find screen IDs.
244
245 The following functions take an array length (`maxDisplays') and array of
246 pointers to CGDirectDisplayIDs (`displays'). The array is filled in with
247 the displays meeting the specified criteria; no more than `maxDisplays'.
248 will be stored in `displays'. The number of displays meeting the criteria
249 is returned in `matchingDisplayCount'.
250
251 If the `displays' array is NULL, only the number of displays meeting the
252 specified criteria is returned in `matchingDisplayCount'. }
253
CGGetDisplaysWithPointnull254 function CGGetDisplaysWithPoint( point: CGPoint; maxDisplays: UInt32; displays: CGDirectDisplayIDPtr; var matchingDisplayCount: UInt32 ): CGError; external name '_CGGetDisplaysWithPoint';
255 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
256
CGGetDisplaysWithRectnull257 function CGGetDisplaysWithRect( rect: CGRect; maxDisplays: UInt32; displays: CGDirectDisplayIDPtr; var matchingDisplayCount: UInt32 ): CGError; external name '_CGGetDisplaysWithRect';
258 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
259
CGGetDisplaysWithOpenGLDisplayMasknull260 function CGGetDisplaysWithOpenGLDisplayMask( mask: CGOpenGLDisplayMask; maxDisplays: UInt32; displays: CGDirectDisplayIDPtr; var matchingDisplayCount: UInt32 ): CGError; external name '_CGGetDisplaysWithOpenGLDisplayMask';
261 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
262
263 { Return a list of active displays.
264
265 If `activeDisplays' is NULL, then `maxDisplays' is ignored, and
266 `displayCount' is set to the number of displays. Otherwise, the list of
267 active displays is stored in `activeDisplays'; no more than `maxDisplays'
268 will be stored in `activeDisplays'.
269
270 The first display returned in the list is the main display (the one with
271 the menu bar). When mirroring, this will be the largest drawable display
272 in the mirror set, or, if all displays are the same size, the one with
273 the deepest pixel depth. }
274
CGGetActiveDisplayListnull275 function CGGetActiveDisplayList( maxDisplays: UInt32; activeDisplays: CGDirectDisplayIDPtr; var displayCount: UInt32 ): CGError; external name '_CGGetActiveDisplayList';
276 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
277
278 { Return a list of online displays.
279
280 If `onlineDisplays' is NULL, then `maxDisplays' is ignored, and
281 `displayCount' is set to the number of displays. Otherwise, the list of
282 online displays is stored in `onlineDisplays'; no more than `maxDisplays'
283 will be stored in `onlineDisplays'.
284
285 With hardware mirroring, a display may be online but not necessarily
286 active or drawable. Programs which manipulate display settings such as
287 the palette or gamma tables need access to all displays in use, including
288 hardware mirrors which are not drawable. }
289
CGGetOnlineDisplayListnull290 function CGGetOnlineDisplayList( maxDisplays: UInt32; onlineDisplays: CGDirectDisplayIDPtr; var displayCount: UInt32 ): CGError; external name '_CGGetOnlineDisplayList';
291 (* CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
292
293 { Return the OpenGL display mask for `display', or 0 if `display' is an
294 invalid display. }
295
CGDisplayIDToOpenGLDisplayMasknull296 function CGDisplayIDToOpenGLDisplayMask( display: CGDirectDisplayID ): CGOpenGLDisplayMask; external name '_CGDisplayIDToOpenGLDisplayMask';
297 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
298
299 { Return the display for the OpenGL display mask `mask', or
300 `kCGNullDirectDisplay' if the bits set dont't match a display. A mask
301 with multiple bits set returns an arbitrary match. }
302
CGOpenGLDisplayMaskToDisplayIDnull303 function CGOpenGLDisplayMaskToDisplayID( mask: CGOpenGLDisplayMask ): CGDirectDisplayID; external name '_CGOpenGLDisplayMaskToDisplayID';
304 (* CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
305
306 { Return the screen size and screen origin of `display' in global
307 coordinates, or `CGRectZero' if `display' is invalid. }
308
CGDisplayBoundsnull309 function CGDisplayBounds( display: CGDirectDisplayID ): CGRect; external name '_CGDisplayBounds';
310 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
311
312 { Return the width in pixels of `display'. }
313
CGDisplayPixelsWidenull314 function CGDisplayPixelsWide( display: CGDirectDisplayID ): size_t; external name '_CGDisplayPixelsWide';
315 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
316
317 { Return the height in pixels of `display'. }
318
CGDisplayPixelsHighnull319 function CGDisplayPixelsHigh( display: CGDirectDisplayID ): size_t; external name '_CGDisplayPixelsHigh';
320 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
321
322 { Return an array of all modes for the specified display, or NULL if
323 `display' is invalid. The "options" field is reserved for future
324 expansion; pass NULL for now. }
325
CGDisplayCopyAllDisplayModesnull326 function CGDisplayCopyAllDisplayModes( display: CGDirectDisplayID; options: CFDictionaryRef ): CFArrayRef; external name '_CGDisplayCopyAllDisplayModes';
327 (* CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) *)
328
329 var kCGDisplayShowDuplicateLowResolutionModes: CFStringRef; external name '_kCGDisplayShowDuplicateLowResolutionModes'; (* attribute const *)
330 (* CG_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
331
332 { Return the current mode of the specified display, or NULL if `display'
333 is invalid. }
334
CGDisplayCopyDisplayModenull335 function CGDisplayCopyDisplayMode( display: CGDirectDisplayID ): CGDisplayModeRef; external name '_CGDisplayCopyDisplayMode';
336 (* CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) *)
337
338 { Switch the display mode of `display' to `mode'. The "options" field is
339 reserved for future expansion; pass NULL for now.
340
341 The selected display mode persists for the life of the program, and
342 automatically reverts to the permanent setting when the program
343 terminates.
344
345 When changing display modes of displays in a mirroring set, other
346 displays in the mirroring set will be set to a display mode capable of
347 mirroring the bounds of the largest display being explicitly set.
348
349 Note that after switching, display parameters and addresses may change. }
350
CGDisplaySetDisplayModenull351 function CGDisplaySetDisplayMode( display: CGDirectDisplayID; mode: CGDisplayModeRef; options: CFDictionaryRef ): CGError; external name '_CGDisplaySetDisplayMode';
352 (* CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) *)
353
354 { Return the width in points of the specified display mode. }
355
CGDisplayModeGetWidthnull356 function CGDisplayModeGetWidth( mode: CGDisplayModeRef ): size_t; external name '_CGDisplayModeGetWidth';
357 (* CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) *)
358
359 { Return the height in points of the specified display mode. }
360
CGDisplayModeGetHeightnull361 function CGDisplayModeGetHeight( mode: CGDisplayModeRef ): size_t; external name '_CGDisplayModeGetHeight';
362 (* CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) *)
363
364 { Return a string representing the pixel encoding of the specified display
365 mode, expressed as a CFString containing an IOKit graphics mode. }
366
CGDisplayModeCopyPixelEncodingnull367 function CGDisplayModeCopyPixelEncoding( mode: CGDisplayModeRef ): CFStringRef; external name '_CGDisplayModeCopyPixelEncoding';
368 (* CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) *)
369
370 { Return the refresh rate of the specified display mode. }
371
CGDisplayModeGetRefreshRatenull372 function CGDisplayModeGetRefreshRate( mode: CGDisplayModeRef ): Float64; external name '_CGDisplayModeGetRefreshRate';
373 (* CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) *)
374
375 { Return the IOKit flags of the specified display mode. }
376
CGDisplayModeGetIOFlagsnull377 function CGDisplayModeGetIOFlags( mode: CGDisplayModeRef ): UInt32; external name '_CGDisplayModeGetIOFlags';
378 (* CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) *)
379
380 { Return the IOKit display mode ID of the specified display mode. }
381
CGDisplayModeGetIODisplayModeIDnull382 function CGDisplayModeGetIODisplayModeID( mode: CGDisplayModeRef ): SInt32; external name '_CGDisplayModeGetIODisplayModeID';
383 (* CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) *)
384
385 { Return true if the specified mode is usable for displaying the
386 desktop GUI; false otherwise. }
387
CGDisplayModeIsUsableForDesktopGUInull388 function CGDisplayModeIsUsableForDesktopGUI( mode: CGDisplayModeRef ): CBool; external name '_CGDisplayModeIsUsableForDesktopGUI';
389 (* CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) *)
390
391 { Return the CFTypeID for CGDisplayModeRefs. }
392
CGDisplayModeGetTypeIDnull393 function CGDisplayModeGetTypeID: CFTypeID; external name '_CGDisplayModeGetTypeID';
394 (* CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) *)
395
396 { Equivalent to `CFRetain(mode)', except it doesn't crash (as CFRetain
397 does) if `mode' is NULL. }
398
CGDisplayModeRetainnull399 function CGDisplayModeRetain( mode: CGDisplayModeRef ): CGDisplayModeRef; external name '_CGDisplayModeRetain';
400 (* CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) *)
401
402 { Equivalent to `CFRelease(mode)', except it doesn't crash (as CFRelease
403 does) if `mode' is NULL. }
404
405 procedure CGDisplayModeRelease( mode: CGDisplayModeRef ); external name '_CGDisplayModeRelease';
406 (* CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) *)
407
408 { Return the width in pixels of the specified display mode. }
409
CGDisplayModeGetPixelWidthnull410 function CGDisplayModeGetPixelWidth( mode: CGDisplayModeRef ): size_t; external name '_CGDisplayModeGetPixelWidth';
411 (* CG_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
412
413 { Return the height in pixels of the specified display mode. }
414
CGDisplayModeGetPixelHeightnull415 function CGDisplayModeGetPixelHeight( mode: CGDisplayModeRef ): size_t; external name '_CGDisplayModeGetPixelHeight';
416 (* CG_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
417
418 { Set the gamma function for `display' by specifying the coefficients of
419 the gamma transfer function.
420
421 Gamma values must be greater than 0. Minimum values must be in the
422 interval [0, 1). Maximum values must be in the interval (0, 1]. Out of
423 range values or maximum values greater than or equal to minimum values
424 return `kCGErrorRangeCheck'.
425
426 Values are computed by sampling a function for a range of indexes from 0
427 to 1:
428 value = Min + ((Max - Min) * pow(index, Gamma))
429 The resulting values are converted to a machine-specific format and
430 loaded into display hardware. }
431
432 type
433 CGGammaValue = Float32;
434 CGGammaValuePtr = ^CGGammaValue;
435
CGSetDisplayTransferByFormulanull436 function CGSetDisplayTransferByFormula( display: CGDirectDisplayID; redMin: CGGammaValue; redMax: CGGammaValue; redGamma: CGGammaValue; greenMin: CGGammaValue; greenMax: CGGammaValue; greenGamma: CGGammaValue; blueMin: CGGammaValue; blueMax: CGGammaValue; blueGamma: CGGammaValue ): CGError; external name '_CGSetDisplayTransferByFormula';
437 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
438
439 { Return the coefficients of the gamma transfer function for `display'. }
440
CGGetDisplayTransferByFormulanull441 function CGGetDisplayTransferByFormula( display: CGDirectDisplayID; var redMin: CGGammaValue; var redMax: CGGammaValue; var redGamma: CGGammaValue; var greenMin: CGGammaValue; var greenMax: CGGammaValue; var greenGamma: CGGammaValue; var blueMin: CGGammaValue; var blueMax: CGGammaValue; var blueGamma: CGGammaValue ): CGError; external name '_CGGetDisplayTransferByFormula';
442 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
443
444 { Return the capacity, or number of entries, in the gamma table for
445 `display', or 0 if 'display' is invalid. }
446
CGDisplayGammaTableCapacitynull447 function CGDisplayGammaTableCapacity( display: CGDirectDisplayID ): UInt32; external name '_CGDisplayGammaTableCapacity';
448 (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_NA) *)
449
450 { Set the gamma function for `display' by specifying the values in the RGB
451 gamma tables.
452
453 Values within each table should be in the interval [0, 1] The same table
454 may be passed in for red, green, and blue channels. The number of entries
455 in the tables is specified by `tableSize'. The tables are interpolated as
456 needed to generate the number of samples needed by the display hardware. }
457
CGSetDisplayTransferByTablenull458 function CGSetDisplayTransferByTable( display: CGDirectDisplayID; tableSize: UInt32; {const var} redTable: CGGammaValuePtr; {const var} greenTable: CGGammaValuePtr; {const var} blueTable: CGGammaValuePtr ): CGError; external name '_CGSetDisplayTransferByTable';
459 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
460
461 { Return the RGB gamma table values for `display'.
462
463 The number of entries in each array is specified by `capacity'; no more
464 than `capacity' entries will be written to each table. The number of
465 entries written is stored in `sampleCount'. }
466
CGGetDisplayTransferByTablenull467 function CGGetDisplayTransferByTable( display: CGDirectDisplayID; capacity: UInt32; redTable: CGGammaValuePtr; greenTable: CGGammaValuePtr; blueTable: CGGammaValuePtr; var sampleCount: UInt32 ): CGError; external name '_CGGetDisplayTransferByTable';
468 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
469
470 { Set the gamma function for `display' by specifying the values in the RGB
471 gamma tables as bytes.
472
473 Values within each table should be in the interval [0, 255] The same
474 table may be passed in for red, green, and blue channels. The number of
475 entries in the tables is specified by `tableSize'. The tables are
476 interpolated as needed to generate the number of samples needed by the
477 display hardware. }
478
CGSetDisplayTransferByByteTablenull479 function CGSetDisplayTransferByByteTable( display: CGDirectDisplayID; tableSize: UInt32; redTable: {const} UInt8Ptr; greenTable: {const} UInt8Ptr; blueTable: {const} UInt8Ptr ): CGError; external name '_CGSetDisplayTransferByByteTable';
480 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
481
482 { Restore the gamma tables of all system displays to the values in the
483 user's ColorSync display profile. }
484
485 procedure CGDisplayRestoreColorSyncSettings; external name '_CGDisplayRestoreColorSyncSettings';
486 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
487
488 { Options used with `CGDisplayCaptureWithOptions' and
489 `CGCaptureAllDisplaysWithOptions'. }
490
491 const
492 kCGCaptureNoOptions = 0; { Default behavior. }
493 kCGCaptureNoFill = 1 shl 0; { Disables fill with black on capture. }
494 type
495 CGCaptureOptions = UInt32;
496
497 { Return true if `display' is captured; false otherwise. }
498
CGDisplayIsCapturednull499 function CGDisplayIsCaptured( display: CGDirectDisplayID ): boolean_t; external name '_CGDisplayIsCaptured';
500 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_9, __IPHONE_NA, __IPHONE_NA) *)
501
502 { Capture `display' for exclusive use by an application. }
503
CGDisplayCapturenull504 function CGDisplayCapture( display: CGDirectDisplayID ): CGError; external name '_CGDisplayCapture';
505 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
506
507 { Capture `display' for exclusive use by an application, using the options
508 specified by `options'. }
509
CGDisplayCaptureWithOptionsnull510 function CGDisplayCaptureWithOptions( display: CGDirectDisplayID; options: CGCaptureOptions ): CGError; external name '_CGDisplayCaptureWithOptions';
511 (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_NA) *)
512
513 { Release the captured display `display'. }
514
CGDisplayReleasenull515 function CGDisplayRelease( display: CGDirectDisplayID ): CGError; external name '_CGDisplayRelease';
516 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
517
518 { Capture all displays. This operation provides an immersive environment
519 for an appplication, and prevents other applications from trying to
520 adjust to display changes. }
521
CGCaptureAllDisplaysnull522 function CGCaptureAllDisplays: CGError; external name '_CGCaptureAllDisplays';
523 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
524
525 { Capture all displays, using the options specified by `options'. This
526 operation provides an immersive environment for an appplication, and
527 prevents other applications from trying to adjust to display changes. }
528
CGCaptureAllDisplaysWithOptionsnull529 function CGCaptureAllDisplaysWithOptions( options: CGCaptureOptions ): CGError; external name '_CGCaptureAllDisplaysWithOptions';
530 (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_NA) *)
531
532 { Release all captured displays and restore the display modes to the user's
533 preferences. May be used in conjunction with `CGDisplayCapture' or
534 `CGCaptureAllDisplays'. }
535
CGReleaseAllDisplaysnull536 function CGReleaseAllDisplays: CGError; external name '_CGReleaseAllDisplays';
537 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
538
539 { Returns window ID of the shield window for the captured display `display',
540 or NULL if the display is not not shielded. }
541
CGShieldingWindowIDnull542 function CGShieldingWindowID( display: CGDirectDisplayID ): UInt32; external name '_CGShieldingWindowID';
543 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
544
545 { Returns the window level of the shield window for the captured display
546 `display'. }
547
CGShieldingWindowLevelnull548 function CGShieldingWindowLevel: SInt32; external name '_CGShieldingWindowLevel';
549 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
550
551 { Return an image containing the contents of the display identified by
552 `displayID'. }
553
CGDisplayCreateImagenull554 function CGDisplayCreateImage( displayID: CGDirectDisplayID ): CGImageRef; external name '_CGDisplayCreateImage';
555 (* CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) *)
556
557 { Return an image containing the contents of the rectangle `rect',
558 specified in display space, of the display identified by `displayID'. The
559 actual rectangle used is the rectangle returned from
560 `CGRectIntegral(rect)'. }
561
CGDisplayCreateImageForRectnull562 function CGDisplayCreateImageForRect( display: CGDirectDisplayID; rect: CGRect ): CGImageRef; external name '_CGDisplayCreateImageForRect';
563 (* CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) *)
564
565 { Hide the mouse cursor and increment the hide cursor count. The `display'
566 parameter is ignored. }
567
CGDisplayHideCursornull568 function CGDisplayHideCursor( display: CGDirectDisplayID ): CGError; external name '_CGDisplayHideCursor';
569 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
570
571 { Decrement the hide cursor count; show the cursor if the hide cursor count
572 is zero. The `display' parameter is ignored. }
573
CGDisplayShowCursornull574 function CGDisplayShowCursor( display: CGDirectDisplayID ): CGError; external name '_CGDisplayShowCursor';
575 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
576
577 { Move the mouse cursor to the specified point relative to the origin (the
578 upper-left corner) of `display'. No events are generated as a result of
579 the move. Points that lie outside the desktop are clipped to the
580 desktop. }
581
CGDisplayMoveCursorToPointnull582 function CGDisplayMoveCursorToPoint( display: CGDirectDisplayID; point: CGPoint ): CGError; external name '_CGDisplayMoveCursorToPoint';
583 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
584
585 { Return the mouse position change since with the last mouse move event
586 received by the application. }
587
588 procedure CGGetLastMouseDelta( var deltaX: SInt32; var deltaY: SInt32 ); external name '_CGGetLastMouseDelta';
589 (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
590
591 { Return a CGContext suitable for drawing to the captured display
592 `display', or NULL if `display' has not been captured. The context is
593 owned by the device and should not be released by the caller.
594
595 The context remains valid while the display is captured and while the
596 display configuration is unchanged. Releasing the captured display or
597 reconfiguring the display invalidates the drawing context.
598
599 The determine when the display configuration is changing, use
600 `CGDisplayRegisterReconfigurationCallback'. }
601
CGDisplayGetDrawingContextnull602 function CGDisplayGetDrawingContext( display: CGDirectDisplayID ): CGContextRef; external name '_CGDisplayGetDrawingContext';
603 (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_NA) *)
604
605
606 {
607 Keys used in mode dictionaries. Source C strings shown won't change.
608 Some CFM environments cannot import data variables, and so
609 the definitions are provided directly.
610
611 These keys are used only within the scope of the mode dictionaries,
612 so further uniquing, as by prefix, of the source string is not needed.
613 }
614
615 { These are deprecated; don't use them. }
616
617 {$ifc USE_CFSTR_CONSTANT_MACROS}
618 {$definec kCGDisplayWidth CFSTRP('Width')}
619 {$endc}
620 {$ifc USE_CFSTR_CONSTANT_MACROS}
621 {$definec kCGDisplayHeight CFSTRP('Height')}
622 {$endc}
623 {$ifc USE_CFSTR_CONSTANT_MACROS}
624 {$definec kCGDisplayMode CFSTRP('Mode')}
625 {$endc}
626 {$ifc USE_CFSTR_CONSTANT_MACROS}
627 {$definec kCGDisplayBitsPerPixel CFSTRP('BitsPerPixel')}
628 {$endc}
629 {$ifc USE_CFSTR_CONSTANT_MACROS}
630 {$definec kCGDisplayBitsPerSample CFSTRP('BitsPerSample')}
631 {$endc}
632 {$ifc USE_CFSTR_CONSTANT_MACROS}
633 {$definec kCGDisplaySamplesPerPixel CFSTRP('SamplesPerPixel')}
634 {$endc}
635 {$ifc USE_CFSTR_CONSTANT_MACROS}
636 {$definec kCGDisplayRefreshRate CFSTRP('RefreshRate')}
637 {$endc}
638 {$ifc USE_CFSTR_CONSTANT_MACROS}
639 {$definec kCGDisplayModeUsableForDesktopGUI CFSTRP('UsableForDesktopGUI')}
640 {$endc}
641 {$ifc USE_CFSTR_CONSTANT_MACROS}
642 {$definec kCGDisplayIOFlags CFSTRP('IOFlags')}
643 {$endc}
644 {$ifc USE_CFSTR_CONSTANT_MACROS}
645 {$definec kCGDisplayBytesPerRow CFSTRP('kCGDisplayBytesPerRow')}
646 {$endc}
647 {$ifc USE_CFSTR_CONSTANT_MACROS}
648 {$definec kCGIODisplayModeID CFSTRP('IODisplayModeID')}
649 {$endc}
650
651 {
652 * Keys to describe optional properties of display modes.
653 *
654 * The key will only be present if the property applies,
655 * and will be associated with a value of kCFBooleanTrue.
656 * Keys not relevant to a particular display mode will not
657 * appear in the mode dictionary.
658 *
659 * These strings must remain unchanged in future releases, of course.
660 }
661
662 { These are deprecated; don't use them. }
663
664 { Set if display mode doesn't need a confirmation dialog to be set }
665 {$ifc USE_CFSTR_CONSTANT_MACROS}
666 {$definec kCGDisplayModeIsSafeForHardware CFSTRP('kCGDisplayModeIsSafeForHardware')}
667 {$endc}
668
669 { The following keys reflect interesting bits of the IOKit display mode flags }
670 {$ifc USE_CFSTR_CONSTANT_MACROS}
671 {$definec kCGDisplayModeIsInterlaced CFSTRP('kCGDisplayModeIsInterlaced')}
672 {$endc}
673 {$ifc USE_CFSTR_CONSTANT_MACROS}
674 {$definec kCGDisplayModeIsStretched CFSTRP('kCGDisplayModeIsStretched')}
675 {$endc}
676 {$ifc USE_CFSTR_CONSTANT_MACROS}
677 {$definec kCGDisplayModeIsTelevisionOutput CFSTRP('kCGDisplayModeIsTelevisionOutput')}
678 {$endc}
679
680 { These types are deprecated; don't use them. }
681
682 type
683 CGDisplayCount = UInt32;
684 CGDisplayErr = CGError;
685 CGBeamPosition = UInt32;
686 CGByteValue = UInt8;
687 CGDisplayCoord = SInt32;
688
689 type
690 CGMouseDelta = SInt32;
691 CGTableCount = UInt32;
692
693 const
694 CGDisplayNoErr=kCGErrorSuccess;
695
696 { These functions are deprecated; do not use them. }
697
698 { Move the mouse cursor to the specified point relative to the origin (the
699 upper-left corner) of `display'. No events are generated as a result of
700 the move. Points that lie outside the desktop are clipped to the
701 desktop. }
702
703 { Use `CGDisplayCreateImage' instead. }
CGDisplayBaseAddressnull704 function CGDisplayBaseAddress( display: CGDirectDisplayID ): UnivPtr; external name '_CGDisplayBaseAddress';
705 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6,__IPHONE_NA, __IPHONE_NA) *)
706
707 {
708 * return address for X,Y in global coordinates;
709 * (0,0) represents the upper left corner of the main display.
710 * returns NULL for an invalid display or out of bounds coordinates
711 * If the display has not been captured, the returned address may refer
712 * to read-only memory.
713 }
714
715 { Use `CGDisplayCreateImageForRect' instead. }
CGDisplayAddressForPositionnull716 function CGDisplayAddressForPosition( display: CGDirectDisplayID; x: CGDisplayCoord; y: CGDisplayCoord ): UnivPtr; external name '_CGDisplayAddressForPosition';
717 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_6, __IPHONE_NA, __IPHONE_NA) *)
718
719 {
720 * Display mode selection
721 * Display modes are represented as CFDictionaries
722 * All dictionaries and arrays returned via these mechanisms are
723 * owned by the framework and should not be released. The framework
724 * will not release them out from under your application.
725 *
726 * Values associated with the following keys are CFNumber types.
727 * With CFNumberGetValue(), use kCFNumberLongType for best results.
728 * kCGDisplayRefreshRate encodes a double value, so to get the fractional
729 * refresh rate use kCFNumberDoubleType.
730 }
731
732 { Use `CGDisplayCreateImage' or `CGDisplayCreateImageForRect' instead. }
CGDisplayBytesPerRownull733 function CGDisplayBytesPerRow( display: CGDirectDisplayID ): size_t; external name '_CGDisplayBytesPerRow';
734 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6, __IPHONE_NA, __IPHONE_NA) *)
735
736 {
737 * Return a CFArray of CFDictionaries describing all display modes.
738 * Returns NULL if the display is invalid.
739 }
740
741 { Use the CGDisplayMode APIs instead. }
CGDisplayAvailableModesnull742 function CGDisplayAvailableModes( display: CGDirectDisplayID ): CFArrayRef; external name '_CGDisplayAvailableModes';
743 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6, __IPHONE_NA, __IPHONE_NA) *)
744
745 { Use the CGDisplayMode APIs instead. }
CGDisplayBestModeForParametersnull746 function CGDisplayBestModeForParameters( display: CGDirectDisplayID; bitsPerPixel: size_t; width: size_t; height: size_t; var exactMatch: boolean_t ): CFDictionaryRef; external name '_CGDisplayBestModeForParameters';
747 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6, __IPHONE_NA, __IPHONE_NA) *)
748
749 { Use the CGDisplayMode APIs instead. }
CGDisplayBestModeForParametersAndRefreshRatenull750 function CGDisplayBestModeForParametersAndRefreshRate( display: CGDirectDisplayID; bitsPerPixel: size_t; width: size_t; height: size_t; refreshRate: CGRefreshRate; var exactMatch: boolean_t ): CFDictionaryRef; external name '_CGDisplayBestModeForParametersAndRefreshRate';
751 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6, __IPHONE_NA, __IPHONE_NA) *)
752
753 { Use the CGDisplayMode APIs instead. }
CGDisplayBestModeForParametersAndRefreshRateWithPropertynull754 function CGDisplayBestModeForParametersAndRefreshRateWithProperty( display: CGDirectDisplayID; bitsPerPixel: size_t; width: size_t; height: size_t; refreshRate: CGRefreshRate; property: CFStringRef; var exactMatch: boolean_t ): CFDictionaryRef; external name '_CGDisplayBestModeForParametersAndRefreshRateWithProperty';
755 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_2, __MAC_10_6, __IPHONE_NA, __IPHONE_NA) *)
756
757 {
758 * Return a CFDictionary describing the current display mode.
759 * Returns NULL if display is invalid.
760 }
761
762 { Use the CGDisplayMode APIs instead. }
CGDisplayCurrentModenull763 function CGDisplayCurrentMode( display: CGDirectDisplayID ): CFDictionaryRef; external name '_CGDisplayCurrentMode';
764 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6, __IPHONE_NA, __IPHONE_NA) *)
765
766 {
767 * Switch display mode. Note that after switching,
768 * display parameters and addresses may change.
769 * The selected display mode persists for the life of the program, and automatically
770 * reverts to the permanent setting made by Preferences when the program terminates.
771 * The mode dictionary passed in must be a dictionary vended by other CGDirectDisplay
772 * APIs such as CGDisplayBestModeForParameters() and CGDisplayAvailableModes().
773 *
774 * The mode dictionary passed in must be a dictionary vended by other CGDirectDisplay
775 * APIs such as CGDisplayBestModeForParameters() and CGDisplayAvailableModes().
776 *
777 * When changing display modes of displays in a mirroring set, other displays in
778 * the mirroring set will be set to a display mode capable of mirroring the bounds
779 * of the largest display being explicitly set.
780 }
781 { Use the CGDisplayMode APIs instead. }
CGDisplaySwitchToModenull782 function CGDisplaySwitchToMode( display: CGDirectDisplayID; mode: CFDictionaryRef ): CGError; external name '_CGDisplaySwitchToMode';
783 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6, __IPHONE_NA, __IPHONE_NA) *)
784
785 { Query parameters for current mode }
786 { Use the CGDisplayMode APIs instead. }
CGDisplayBitsPerPixelnull787 function CGDisplayBitsPerPixel( display: CGDirectDisplayID ): size_t; external name '_CGDisplayBitsPerPixel';
788 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6, __IPHONE_NA, __IPHONE_NA) *)
789
790 { Use the CGDisplayMode APIs instead. }
CGDisplayBitsPerSamplenull791 function CGDisplayBitsPerSample( display: CGDirectDisplayID ): size_t; external name '_CGDisplayBitsPerSample';
792 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6, __IPHONE_NA, __IPHONE_NA) *)
793
794 { Use the CGDisplayMode APIs instead. }
CGDisplaySamplesPerPixelnull795 function CGDisplaySamplesPerPixel( display: CGDirectDisplayID ): size_t; external name '_CGDisplaySamplesPerPixel';
796 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6, __IPHONE_NA, __IPHONE_NA) *)
797
CGDisplayCanSetPalettenull798 function CGDisplayCanSetPalette( display: CGDirectDisplayID ): boolean_t; external name '_CGDisplayCanSetPalette';
799 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
800
CGDisplaySetPalettenull801 function CGDisplaySetPalette( display: CGDirectDisplayID; palette: CGDirectPaletteRef ): CGError; external name '_CGDisplaySetPalette';
802 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
803
CGDisplayWaitForBeamPositionOutsideLinesnull804 function CGDisplayWaitForBeamPositionOutsideLines( display: CGDirectDisplayID; upperScanLine: UInt32; lowerScanLine: UInt32 ): CGError; external name '_CGDisplayWaitForBeamPositionOutsideLines';
805 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
806
CGDisplayBeamPositionnull807 function CGDisplayBeamPosition( display: CGDirectDisplayID ): UInt32; external name '_CGDisplayBeamPosition';
808 (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
809
810
811 {$endc}
812 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
813
814 end.
815 {$endc} {not MACOSALLINCLUDE}
816