5
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
8
{ Pascal Translation Updated: Peter N Lewis, <peter@stairways.com.au>, August 2005 }
10
Modified for use with Free Pascal
12
Please report any bugs to <gpc@microbizz.nl>
23
{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
24
{$setc GAP_INTERFACES_VERSION := $0200}
26
{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
27
{$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
30
{$ifc defined CPUPOWERPC and defined CPUI386}
31
{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
33
{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
34
{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
37
{$ifc not defined __ppc__ and defined CPUPOWERPC}
42
{$ifc not defined __i386__ and defined CPUI386}
48
{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
49
{$error Conflicting definitions for __ppc__ and __i386__}
52
{$ifc defined __ppc__ and __ppc__}
53
{$setc TARGET_CPU_PPC := TRUE}
54
{$setc TARGET_CPU_X86 := FALSE}
55
{$elifc defined __i386__ and __i386__}
56
{$setc TARGET_CPU_PPC := FALSE}
57
{$setc TARGET_CPU_X86 := TRUE}
59
{$error Neither __ppc__ nor __i386__ is defined.}
61
{$setc TARGET_CPU_PPC_64 := FALSE}
63
{$ifc defined FPC_BIG_ENDIAN}
64
{$setc TARGET_RT_BIG_ENDIAN := TRUE}
65
{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
66
{$elifc defined FPC_LITTLE_ENDIAN}
67
{$setc TARGET_RT_BIG_ENDIAN := FALSE}
68
{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
70
{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
72
{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
73
{$setc CALL_NOT_IN_CARBON := FALSE}
74
{$setc OLDROUTINENAMES := FALSE}
75
{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
76
{$setc OPAQUE_UPP_TYPES := TRUE}
77
{$setc OTCARBONAPPLICATION := TRUE}
78
{$setc OTKERNEL := FALSE}
79
{$setc PM_USE_SESSION_APIS := TRUE}
80
{$setc TARGET_API_MAC_CARBON := TRUE}
81
{$setc TARGET_API_MAC_OS8 := FALSE}
82
{$setc TARGET_API_MAC_OSX := TRUE}
83
{$setc TARGET_CARBON := TRUE}
84
{$setc TARGET_CPU_68K := FALSE}
85
{$setc TARGET_CPU_MIPS := FALSE}
86
{$setc TARGET_CPU_SPARC := FALSE}
87
{$setc TARGET_OS_MAC := TRUE}
88
{$setc TARGET_OS_UNIX := FALSE}
89
{$setc TARGET_OS_WIN32 := FALSE}
90
{$setc TARGET_RT_MAC_68881 := FALSE}
91
{$setc TARGET_RT_MAC_CFM := FALSE}
92
{$setc TARGET_RT_MAC_MACHO := TRUE}
93
{$setc TYPED_FUNCTION_POINTERS := TRUE}
94
{$setc TYPE_BOOL := FALSE}
95
{$setc TYPE_EXTENDED := FALSE}
96
{$setc TYPE_LONGLONG := TRUE}
97
uses MacTypes,CFBase,CFArray,CFDictionary,CGContext,CGBase,CGGeometry,CGErrors;
102
* The following construct is present to avoid problems with some Apple tools.
103
* API in this module is not available in Mac OS Classic variations!
108
CGDirectDisplayID = ^SInt32; { an opaque 32-bit type }
109
CGDirectDisplayIDPtr = ^CGDirectDisplayID; { when a var xx:CGDirectDisplayID parameter can be nil, it is changed to xx: CGDirectDisplayIDPtr }
111
CGDirectPaletteRef = ^SInt32; { an opaque 32-bit type }
112
CGDirectPaletteRefPtr = ^CGDirectPaletteRef; { when a var xx:CGDirectPaletteRef parameter can be nil, it is changed to xx: CGDirectPaletteRefPtr }
114
CGDisplayCount = UInt32;
116
CGTableCount = UInt32;
118
CGDisplayCoord = SInt32;
121
CGByteValuePtr = ^CGByteValue;
123
CGOpenGLDisplayMask = UInt32;
125
CGBeamPosition = UInt32;
127
CGMouseDelta = SInt32;
129
CGRefreshRate = double;
131
CGCaptureOptions = UInt32;
134
CGDisplayErr = CGError;
137
CGDisplayNoErr = kCGErrorSuccess;
139
kCGDirectMainDisplay = nil;
141
{ Returns the display ID of the current main display }
142
function CGMainDisplayID: CGDirectDisplayID; external name '_CGMainDisplayID';
145
* Mechanisms used to find screen IDs
146
* An array length (maxDisplays) and array of CGDirectDisplayIDs are passed in.
147
* Up to maxDisplays of the array are filled in with the displays meeting the
148
* specified criteria. The actual number of displays filled in is returned in
151
* If the dspys array is NULL, maxDisplays is ignored, and *dspyCnt is filled
152
* in with the number of displays meeting the function's requirements.
154
function CGGetDisplaysWithPoint( point: CGPoint; maxDisplays: CGDisplayCount; dspys: CGDirectDisplayIDPtr; var dspyCnt: CGDisplayCount ): CGDisplayErr; external name '_CGGetDisplaysWithPoint';
156
function CGGetDisplaysWithRect( rect: CGRect; maxDisplays: CGDisplayCount; dspys: CGDirectDisplayIDPtr; var dspyCnt: CGDisplayCount ): CGDisplayErr; external name '_CGGetDisplaysWithRect';
158
function CGGetDisplaysWithOpenGLDisplayMask( mask: CGOpenGLDisplayMask; maxDisplays: CGDisplayCount; dspys: CGDirectDisplayIDPtr; var dspyCnt: CGDisplayCount ): CGDisplayErr; external name '_CGGetDisplaysWithOpenGLDisplayMask';
161
* Get lists of displays. Use this to determine display IDs
163
* If the activeDspys array is NULL, maxDisplays is ignored, and *dspyCnt is filled
164
* in with the number of displays meeting the function's requirements.
166
* The first display returned in the list is the main display,
167
* the one with the menu bar.
168
* When mirroring, this will be the largest drawable display in the mirror,
169
* set, or if all are the same size, the one with the deepest pixel depth.
171
function CGGetActiveDisplayList( maxDisplays: CGDisplayCount; activeDspys: CGDirectDisplayIDPtr; var dspyCnt: CGDisplayCount ): CGDisplayErr; external name '_CGGetActiveDisplayList';
174
* With hardware mirroring, a display may be on-line,
175
* but not necessarily active, or drawable.
176
* Programs which manipulate display settings such as the
177
* palette or gamma tables need access to all displays in use,
178
* including hardware mirrors which are not drawable.
180
function CGGetOnlineDisplayList( maxDisplays: CGDisplayCount; onlineDspys: CGDirectDisplayIDPtr; var dspyCnt: CGDisplayCount ): CGDisplayErr; external name '_CGGetOnlineDisplayList';
182
{ Map a display to an OpenGL display mask; returns 0 on invalid display }
183
function CGDisplayIDToOpenGLDisplayMask( display: CGDirectDisplayID ): CGOpenGLDisplayMask; external name '_CGDisplayIDToOpenGLDisplayMask';
186
* Map an OpenGL display mask to a display.
187
* Returns kCGNullDirectDisplay if a bit doesn't
189
* Passing in multiple bits results in an arbitrary match.
191
function CGOpenGLDisplayMaskToDisplayID( mask: CGOpenGLDisplayMask ): CGDirectDisplayID; external name '_CGOpenGLDisplayMaskToDisplayID';
193
{ Return screen size and origin in global coords; Empty rect if display is invalid }
194
function CGDisplayBounds( display: CGDirectDisplayID ): CGRect; external name '_CGDisplayBounds';
196
function CGDisplayPixelsWide( display: CGDirectDisplayID ): size_t; external name '_CGDisplayPixelsWide';
197
function CGDisplayPixelsHigh( display: CGDirectDisplayID ): size_t; external name '_CGDisplayPixelsHigh';
200
* Display mode selection
201
* Display modes are represented as CFDictionaries
202
* All dictionaries and arrays returned via these mechanisms are
203
* owned by the framework and should not be released. The framework
204
* will not release them out from under your application.
206
* Values associated with the following keys are CFNumber types.
207
* With CFNumberGetValue(), use kCFNumberLongType for best results.
208
* kCGDisplayRefreshRate encodes a double value, so to get the fractional
209
* refresh rate use kCFNumberDoubleType.
213
* Keys used in mode dictionaries. Source C strings shown won't change.
214
* Some CFM environments cannot import data variables, and so
215
* the definitions are provided directly.
217
* These keys are used only within the scope of the mode dictionaries,
218
* so further uniquing, as by prefix, of the source string is not needed.
220
{$ifc USE_CFSTR_CONSTANT_MACROS}
221
{$definec kCGDisplayWidth CFSTRP('Width')}
223
{$ifc USE_CFSTR_CONSTANT_MACROS}
224
{$definec kCGDisplayHeight CFSTRP('Height')}
226
{$ifc USE_CFSTR_CONSTANT_MACROS}
227
{$definec kCGDisplayMode CFSTRP('Mode')}
229
{$ifc USE_CFSTR_CONSTANT_MACROS}
230
{$definec kCGDisplayBitsPerPixel CFSTRP('BitsPerPixel')}
232
{$ifc USE_CFSTR_CONSTANT_MACROS}
233
{$definec kCGDisplayBitsPerSample CFSTRP('BitsPerSample')}
235
{$ifc USE_CFSTR_CONSTANT_MACROS}
236
{$definec kCGDisplaySamplesPerPixel CFSTRP('SamplesPerPixel')}
238
{$ifc USE_CFSTR_CONSTANT_MACROS}
239
{$definec kCGDisplayRefreshRate CFSTRP('RefreshRate')}
241
{$ifc USE_CFSTR_CONSTANT_MACROS}
242
{$definec kCGDisplayModeUsableForDesktopGUI CFSTRP('UsableForDesktopGUI')}
244
{$ifc USE_CFSTR_CONSTANT_MACROS}
245
{$definec kCGDisplayIOFlags CFSTRP('IOFlags')}
247
{$ifc USE_CFSTR_CONSTANT_MACROS}
248
{$definec kCGDisplayBytesPerRow CFSTRP('kCGDisplayBytesPerRow')}
252
* Keys to describe optional properties of display modes.
254
* The key will only be present if the property applies,
255
* and will be associated with a value of kCFBooleanTrue.
256
* Keys not relevant to a particular display mode will not
257
* appear in the mode dictionary.
259
* These strings must remain unchanged in future releases, of course.
262
{ Set if display mode doesn't need a confirmation dialog to be set }
263
{$ifc USE_CFSTR_CONSTANT_MACROS}
264
{$definec kCGDisplayModeIsSafeForHardware CFSTRP('kCGDisplayModeIsSafeForHardware')}
267
{ The following keys reflect interesting bits of the IOKit display mode flags }
268
{$ifc USE_CFSTR_CONSTANT_MACROS}
269
{$definec kCGDisplayModeIsInterlaced CFSTRP('kCGDisplayModeIsInterlaced')}
271
{$ifc USE_CFSTR_CONSTANT_MACROS}
272
{$definec kCGDisplayModeIsStretched CFSTRP('kCGDisplayModeIsStretched')}
274
{$ifc USE_CFSTR_CONSTANT_MACROS}
275
{$definec kCGDisplayModeIsTelevisionOutput CFSTRP('kCGDisplayModeIsTelevisionOutput')}
280
* Return a CFArray of CFDictionaries describing all display modes.
281
* Returns NULL if the display is invalid.
283
function CGDisplayAvailableModes( display: CGDirectDisplayID ): CFArrayRef; external name '_CGDisplayAvailableModes';
285
* Try to find a display mode of specified depth with dimensions equal or greater than
287
* If no depth match is found, try for the next larger depth with dimensions equal or greater
288
* than specified. If no luck, then just return the current mode.
290
* exactmatch, if not NULL, is set to 'true' if an exact match in width, height, and depth is found,
291
* and 'false' otherwise.
293
* CGDisplayBestModeForParametersAndRefreshRateWithProperty searches the list, looking for
294
* display modes with the specified property. The property should be one of:
295
* kCGDisplayModeIsSafeForHardware;
296
* kCGDisplayModeIsInterlaced;
297
* kCGDisplayModeIsStretched;
298
* kCGDisplayModeIsTelevisionOutput
300
* Returns NULL if display is invalid.
302
function CGDisplayBestModeForParameters( display: CGDirectDisplayID; bitsPerPixel: size_t; width: size_t; height: size_t; var exactMatch: boolean_t ): CFDictionaryRef; external name '_CGDisplayBestModeForParameters';
304
function CGDisplayBestModeForParametersAndRefreshRate( display: CGDirectDisplayID; bitsPerPixel: size_t; width: size_t; height: size_t; refresh: CGRefreshRate; var exactMatch: boolean_t ): CFDictionaryRef; external name '_CGDisplayBestModeForParametersAndRefreshRate';
306
function CGDisplayBestModeForParametersAndRefreshRateWithProperty( display: CGDirectDisplayID; bitsPerPixel: size_t; width: size_t; height: size_t; refresh: CGRefreshRate; property: CFStringRef; var exactMatch: boolean_t ): CFDictionaryRef; external name '_CGDisplayBestModeForParametersAndRefreshRateWithProperty';
309
* Return a CFDictionary describing the current display mode.
310
* Returns NULL if display is invalid.
312
function CGDisplayCurrentMode( display: CGDirectDisplayID ): CFDictionaryRef; external name '_CGDisplayCurrentMode';
314
* Switch display mode. Note that after switching,
315
* display parameters and addresses may change.
316
* The selected display mode persists for the life of the program, and automatically
317
* reverts to the permanent setting made by Preferences when the program terminates.
318
* The mode dictionary passed in must be a dictionary vended by other CGDirectDisplay
319
* APIs such as CGDisplayBestModeForParameters() and CGDisplayAvailableModes().
321
* The mode dictionary passed in must be a dictionary vended by other CGDirectDisplay
322
* APIs such as CGDisplayBestModeForParameters() and CGDisplayAvailableModes().
324
* When changing display modes of displays in a mirroring set, other displays in
325
* the mirroring set will be set to a display mode capable of mirroring the bounds
326
* of the largest display being explicitly set.
328
function CGDisplaySwitchToMode( display: CGDirectDisplayID; mode: CFDictionaryRef ): CGDisplayErr; external name '_CGDisplaySwitchToMode';
330
{ Query parameters for current mode }
331
function CGDisplayBitsPerPixel( display: CGDirectDisplayID ): size_t; external name '_CGDisplayBitsPerPixel';
332
function CGDisplayBitsPerSample( display: CGDirectDisplayID ): size_t; external name '_CGDisplayBitsPerSample';
333
function CGDisplaySamplesPerPixel( display: CGDirectDisplayID ): size_t; external name '_CGDisplaySamplesPerPixel';
334
function CGDisplayBytesPerRow( display: CGDirectDisplayID ): size_t; external name '_CGDisplayBytesPerRow';
337
* Set a display gamma/transfer function from a formula specifying
338
* min and max values and a gamma for each channel.
339
* Gamma values must be greater than 0.0.
340
* To get an antigamma of 1.6, one would specify a value of (1.0 / 1.6)
341
* Min values must be greater than or equal to 0.0 and less than 1.0.
342
* Max values must be greater than 0.0 and less than or equal to 1.0.
343
* Out of range values, or Max greater than or equal to Min result
344
* in a kCGSRangeCheck error.
346
* Values are computed by sampling a function for a range of indices from 0 through 1:
347
* value = Min + ((Max - Min) * pow(index, Gamma))
348
* The resulting values are converted to a machine specific format
349
* and loaded into hardware.
352
CGGammaValue = Float32;
353
CGGammaValuePtr = ^CGGammaValue;
355
function CGSetDisplayTransferByFormula( display: CGDirectDisplayID; redMin: CGGammaValue; redMax: CGGammaValue; redGamma: CGGammaValue; greenMin: CGGammaValue; greenMax: CGGammaValue; greenGamma: CGGammaValue; blueMin: CGGammaValue; blueMax: CGGammaValue; blueGamma: CGGammaValue ): CGDisplayErr; external name '_CGSetDisplayTransferByFormula';
357
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 ): CGDisplayErr; external name '_CGGetDisplayTransferByFormula';
359
* Returns the capacity, or nunber of entries, in the camma table for the specified
360
* display. If 'display' is invalid, returns 0.
362
function CGDisplayGammaTableCapacity( display: CGDirectDisplayID ): CGTableCount; external name '_CGDisplayGammaTableCapacity'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
365
* Set a display gamma/transfer function using tables of data for each channel.
366
* Values within each table should have values in the range of 0.0 through 1.0.
367
* The same table may be passed in for red, green, and blue channels. 'tableSize'
368
* indicates the number of entries in each table.
369
* The tables are interpolated as needed to generate the number of samples needed
372
function CGSetDisplayTransferByTable( display: CGDirectDisplayID; tableSize: CGTableCount; redTable: {const} CGGammaValuePtr; greenTable: {const} CGGammaValuePtr; blueTable: {const} CGGammaValuePtr ): CGDisplayErr; external name '_CGSetDisplayTransferByTable';
375
* Get transfer tables. Capacity should contain the number of samples each
376
* array can hold, and *sampleCount is filled in with the number of samples
377
* actually copied in.
379
function CGGetDisplayTransferByTable( display: CGDirectDisplayID; capacity: CGTableCount; redTable: CGGammaValuePtr; greenTable: CGGammaValuePtr; blueTable: CGGammaValuePtr; var sampleCount: CGTableCount ): CGDisplayErr; external name '_CGGetDisplayTransferByTable';
381
{ As a convenience, allow setting of the gamma table by byte values }
382
function CGSetDisplayTransferByByteTable( display: CGDirectDisplayID; tableSize: CGTableCount; redTable: {const} CGByteValuePtr; greenTable: {const} CGByteValuePtr; blueTable: {const} CGByteValuePtr ): CGDisplayErr; external name '_CGSetDisplayTransferByByteTable';
384
{ Restore gamma tables of system displays to the user's ColorSync specified values }
385
procedure CGDisplayRestoreColorSyncSettings; external name '_CGDisplayRestoreColorSyncSettings';
388
* Options used with CGDisplayCaptureWithOptions and CGCaptureAllDisplaysWithOptions
391
kCGCaptureNoOptions = 0; { Default behavior }
392
kCGCaptureNoFill = 1 shl 0; { Disables fill with black on display capture }
394
{ Display capture and release }
395
function CGDisplayIsCaptured( display: CGDirectDisplayID ): boolean_t; external name '_CGDisplayIsCaptured';
396
function CGDisplayCapture( display: CGDirectDisplayID ): CGDisplayErr; external name '_CGDisplayCapture';
397
function CGDisplayCaptureWithOptions( display: CGDirectDisplayID; options: CGCaptureOptions ): CGDisplayErr; external name '_CGDisplayCaptureWithOptions'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
398
function CGDisplayRelease( display: CGDirectDisplayID ): CGDisplayErr; external name '_CGDisplayRelease';
401
* Capture all displays; this has the nice effect of providing an immersive
402
* environment, and preventing other apps from trying to adjust themselves
403
* to display changes only needed by your app.
405
function CGCaptureAllDisplays: CGDisplayErr; external name '_CGCaptureAllDisplays';
406
function CGCaptureAllDisplaysWithOptions( options: CGCaptureOptions ): CGDisplayErr; external name '_CGCaptureAllDisplaysWithOptions'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
409
* Release all captured displays, and restore the display modes to the
410
* user's preferences. May be used in conjunction with CGDisplayCapture()
411
* or CGCaptureAllDisplays().
413
function CGReleaseAllDisplays: CGDisplayErr; external name '_CGReleaseAllDisplays';
416
* Returns CoreGraphics raw shield window ID or NULL if not shielded
417
* This value may be used with drawing surface APIs.
419
function CGShieldingWindowID( display: CGDirectDisplayID ): UnivPtr; external name '_CGShieldingWindowID';
422
* Returns the window level used for the shield window.
423
* This value may be used with Cocoa windows to position the
424
* Cocoa window in the same window level as the shield window.
426
function CGShieldingWindowLevel: SInt32; external name '_CGShieldingWindowLevel';
429
* Returns base address of display or NULL for an invalid display.
430
* If the display has not been captured, the returned address may refer
431
* to read-only memory.
433
function CGDisplayBaseAddress( display: CGDirectDisplayID ): UnivPtr; external name '_CGDisplayBaseAddress';
435
* return address for X,Y in global coordinates;
436
* (0,0) represents the upper left corner of the main display.
437
* returns NULL for an invalid display or out of bounds coordinates
438
* If the display has not been captured, the returned address may refer
439
* to read-only memory.
441
function CGDisplayAddressForPosition( display: CGDirectDisplayID; x: CGDisplayCoord; y: CGDisplayCoord ): UnivPtr; external name '_CGDisplayAddressForPosition';
444
{ Mouse Cursor controls }
445
function CGDisplayHideCursor( display: CGDirectDisplayID ): CGDisplayErr; external name '_CGDisplayHideCursor'; { increments hide cursor count }
446
function CGDisplayShowCursor( display: CGDirectDisplayID ): CGDisplayErr; external name '_CGDisplayShowCursor'; { decrements hide cursor count }
449
* Move the cursor to the specified point relative to the display origin
450
* (the upper left corner of the display). Returns CGDisplayNoErr on success.
451
* No events are generated as a result of this move.
452
* Points that would lie outside the desktop are clipped to the desktop.
454
function CGDisplayMoveCursorToPoint( display: CGDirectDisplayID; point: CGPoint ): CGDisplayErr; external name '_CGDisplayMoveCursorToPoint';
457
* Report the mouse position change associated with the last mouse move event
458
* recieved by this application.
460
procedure CGGetLastMouseDelta( var deltaX: CGMouseDelta; var deltaY: CGMouseDelta ); external name '_CGGetLastMouseDelta';
463
{ Palette controls (8 bit pseudocolor only) }
466
* Returns TRUE if the current display mode supports palettes.
467
* Display must not be a hardware mirror of another, and should
468
* have a depth of 8 bits per pixel for this to return TRUE.
470
function CGDisplayCanSetPalette( display: CGDirectDisplayID ): boolean_t; external name '_CGDisplayCanSetPalette';
473
* Set a palette. The current gamma function is applied to the palette
474
* elements before being loaded into hardware. The display must not be
475
* a hardware mirror of another, and should have a depth of 8 bits per pixel.
476
* Setting the palette on the active, or primary display in a hardware
477
* mirroring set affects all displays in that set.
479
function CGDisplaySetPalette( display: CGDirectDisplayID; palette: CGDirectPaletteRef ): CGDisplayErr; external name '_CGDisplaySetPalette';
482
* Wait until the beam position is outside the range specified by upperScanLine and lowerScanLine.
483
* Note that if upperScanLine and lowerScanLine encompass the entire display height,
484
* the function returns an error.
485
* lowerScanLine must be greater than or equal to upperScanLine.
487
* Some display systems may not conventional video vertical and horizontal sweep in painting.
488
* These displays report a kCGDisplayRefreshRate of 0 in the CFDictionaryRef returned by
489
* CGDisplayCurrentMode(). On such displays, this function returns at once.
491
* Some drivers may not implement support for this mechanism.
492
* On such displays, this function returns at once.
494
* Returns CGDisplayNoErr on success, and an error if display or upperScanLine and
495
* lowerScanLine are invalid.
497
* The app should set the values of upperScanLine and lowerScanLine to allow enough lead time
498
* for the drawing operation to complete. A common strategy is to wait for the beam to pass
499
* the bottom of the drawing area, allowing almost a full vertical sweep period to perform drawing.
500
* To do this, set upperScanLine to 0, and set lowerScanLine to the bottom of the bounding box:
501
* lowerScanLine = (CGBeamPosition)(cgrect.origin.y + cgrect.size.height);
503
* IOKit may implement this as a spin-loop on the beam position call used for CGDisplayBeamPosition().
504
* On such system the function is CPU bound, and subject to all the usual scheduling pre-emption.
505
* In particular, attempting to wait for the beam to hit a specific scanline may be an exercise in frustration.
507
* These functions are advisary in nature, and depend on IOKit and hardware specific drivers to implement
508
* support. If you need extremely precise timing, or access to vertical blanking interrupts,
509
* you should consider writing a device driver to tie into hardware-specific capabilities.
511
function CGDisplayWaitForBeamPositionOutsideLines( display: CGDirectDisplayID; upperScanLine: CGBeamPosition; lowerScanLine: CGBeamPosition ): CGDisplayErr; external name '_CGDisplayWaitForBeamPositionOutsideLines';
514
* Returns the current beam position on the display. If display is invalid,
515
* or the display does not implement conventional video vertical and horizontal
516
* sweep in painting, or the driver does not implement this functionality, 0 is returned.
518
function CGDisplayBeamPosition( display: CGDirectDisplayID ): CGBeamPosition; external name '_CGDisplayBeamPosition';
521
* Obtain a CGContextRef suitable for drawing to a captured display.
523
* Returns a drawing context suitable for use on the display device.
524
* The context is owned by the device, and should not be released by
527
* The context remains valid while the display is captured, and the
528
* display configuration is unchanged. Releasing the captured display
529
* or reconfiguring the display invalidates the drawing context.
531
* An application may register a display reconfiguration callback to determine
532
* when the display configuration is changing via CGRegisterDisplayReconfigurationProc().
534
* After a display configuration change, or on capturing a display, call this
535
* function to obtain a current drawing context.
537
* If the display has not been captured, this function returns NULL.
539
function CGDisplayGetDrawingContext( display: CGDirectDisplayID ): CGContextRef; external name '_CGDisplayGetDrawingContext'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)