|
Mac OS 9
|
CoreGraphics direct display. More...
#include <CGBase.h>#include <CGGeometry.h>#include <CGError.h>#include <CFArray.h>#include <CFString.h>#include <CFDictionary.h>Go to the source code of this file.
Macros | |
| #define | kCGDirectMainDisplay ((CGDirectDisplayID)NULL) |
Typedefs | |
| typedef struct _CGDirectDisplayID * | CGDirectDisplayID |
| typedef struct _CGDirectPaletteRef * | CGDirectPaletteRef |
| typedef u_int32_t | CGDisplayCount |
| typedef u_int32_t | CGTableCount |
| typedef int32_t | CGDisplayCoord |
| typedef u_int8_t | CGByteValue |
| typedef u_int32_t | CGOpenGLDisplayMask |
| typedef u_int32_t | CGBeamPosition |
| typedef int32_t | CGMouseDelta |
| typedef double | CGRefreshRate |
| typedef CGError | CGDisplayErr |
| typedef float | CGGammaValue |
Enumerations | |
| enum | { CGDisplayNoErr = kCGErrorSuccess } |
Functions | |
| CGDisplayErr | CGGetDisplaysWithPoint (CGPoint point, CGDisplayCount maxDisplays, CGDirectDisplayID *dspys, CGDisplayCount *dspyCnt) |
| CGDisplayErr | CGGetDisplaysWithRect (CGRect rect, CGDisplayCount maxDisplays, CGDirectDisplayID *dspys, CGDisplayCount *dspyCnt) |
| CGDisplayErr | CGGetDisplaysWithOpenGLDisplayMask (CGOpenGLDisplayMask mask, CGDisplayCount maxDisplays, CGDirectDisplayID *dspys, CGDisplayCount *dspyCnt) |
| CGDisplayErr | CGGetActiveDisplayList (CGDisplayCount maxDisplays, CGDirectDisplayID *activeDspys, CGDisplayCount *dspyCnt) |
| CGOpenGLDisplayMask | CGDisplayIDToOpenGLDisplayMask (CGDirectDisplayID display) |
| CGRect | CGDisplayBounds (CGDirectDisplayID display) |
| size_t | CGDisplayPixelsWide (CGDirectDisplayID display) |
| size_t | CGDisplayPixelsHigh (CGDirectDisplayID display) |
| CFArrayRef | CGDisplayAvailableModes (CGDirectDisplayID display) |
| CFDictionaryRef | CGDisplayBestModeForParameters (CGDirectDisplayID display, size_t bitsPerPixel, size_t width, size_t height, boolean_t *exactMatch) |
| CFDictionaryRef | CGDisplayBestModeForParametersAndRefreshRate (CGDirectDisplayID display, size_t bitsPerPixel, size_t width, size_t height, CGRefreshRate refresh, boolean_t *exactMatch) |
| CFDictionaryRef | CGDisplayCurrentMode (CGDirectDisplayID display) |
| CGDisplayErr | CGDisplaySwitchToMode (CGDirectDisplayID display, CFDictionaryRef mode) |
| size_t | CGDisplayBitsPerPixel (CGDirectDisplayID display) |
| size_t | CGDisplayBitsPerSample (CGDirectDisplayID display) |
| size_t | CGDisplaySamplesPerPixel (CGDirectDisplayID display) |
| size_t | CGDisplayBytesPerRow (CGDirectDisplayID display) |
| CGDisplayErr | CGSetDisplayTransferByFormula (CGDirectDisplayID display, CGGammaValue redMin, CGGammaValue redMax, CGGammaValue redGamma, CGGammaValue greenMin, CGGammaValue greenMax, CGGammaValue greenGamma, CGGammaValue blueMin, CGGammaValue blueMax, CGGammaValue blueGamma) |
| CGDisplayErr | CGGetDisplayTransferByFormula (CGDirectDisplayID display, CGGammaValue *redMin, CGGammaValue *redMax, CGGammaValue *redGamma, CGGammaValue *greenMin, CGGammaValue *greenMax, CGGammaValue *greenGamma, CGGammaValue *blueMin, CGGammaValue *blueMax, CGGammaValue *blueGamma) |
| CGDisplayErr | CGSetDisplayTransferByTable (CGDirectDisplayID display, CGTableCount tableSize, const CGGammaValue *redTable, const CGGammaValue *greenTable, const CGGammaValue *blueTable) |
| CGDisplayErr | CGGetDisplayTransferByTable (CGDirectDisplayID display, CGTableCount capacity, CGGammaValue *redTable, CGGammaValue *greenTable, CGGammaValue *blueTable, CGTableCount *sampleCount) |
| CGDisplayErr | CGSetDisplayTransferByByteTable (CGDirectDisplayID display, CGTableCount tableSize, const CGByteValue *redTable, const CGByteValue *greenTable, const CGByteValue *blueTable) |
| void | CGDisplayRestoreColorSyncSettings (void) |
| boolean_t | CGDisplayIsCaptured (CGDirectDisplayID display) |
| CGDisplayErr | CGDisplayCapture (CGDirectDisplayID display) |
| CGDisplayErr | CGDisplayRelease (CGDirectDisplayID display) |
| CGDisplayErr | CGCaptureAllDisplays (void) |
| CGDisplayErr | CGReleaseAllDisplays (void) |
| void * | CGShieldingWindowID (CGDirectDisplayID display) |
| int32_t | CGShieldingWindowLevel (void) |
| void * | CGDisplayBaseAddress (CGDirectDisplayID display) |
| void * | CGDisplayAddressForPosition (CGDirectDisplayID display, CGDisplayCoord x, CGDisplayCoord y) |
| CGDisplayErr | CGDisplayHideCursor (CGDirectDisplayID display) |
| CGDisplayErr | CGDisplayShowCursor (CGDirectDisplayID display) |
| CGDisplayErr | CGDisplayMoveCursorToPoint (CGDirectDisplayID display, CGPoint point) |
| void | CGGetLastMouseDelta (CGMouseDelta *deltaX, CGMouseDelta *deltaY) |
| boolean_t | CGDisplayCanSetPalette (CGDirectDisplayID display) |
| CGDisplayErr | CGDisplaySetPalette (CGDirectDisplayID display, CGDirectPaletteRef palette) |
| CGDisplayErr | CGDisplayWaitForBeamPositionOutsideLines (CGDirectDisplayID display, CGBeamPosition upperScanLine, CGBeamPosition lowerScanLine) |
| CGBeamPosition | CGDisplayBeamPosition (CGDirectDisplayID display) |
Variables | |
| CFStringRef | kCGDisplayWidth |
| CFStringRef | kCGDisplayHeight |
| CFStringRef | kCGDisplayMode |
| CFStringRef | kCGDisplayBitsPerPixel |
| CFStringRef | kCGDisplayBitsPerSample |
| CFStringRef | kCGDisplaySamplesPerPixel |
| CFStringRef | kCGDisplayRefreshRate |
| CFStringRef | kCGDisplayModeUsableForDesktopGUI |
| CFStringRef | kCGDisplayIOFlags |
CoreGraphics direct display.
For bug reports, consult the following page on the World Wide Web:
http://developer.apple.com/bugreporter/
| #define kCGDirectMainDisplay ((CGDirectDisplayID)NULL) |
A NULL value points to the main display device as a programming convention
| typedef float CGGammaValue |
Set a display gamma/transfer function from a formula specifying min and max values and a gamma for each channel. Gamma values must be greater than 0.0. To get an antigamma of 1.6, one would specify a value of (1.0 / 1.6) Min values must be greater than or equal to 0.0 and less than 1.0. Max values must be greater than 0.0 and less than or equal to 1.0. Out of range values, or Max greater than or equal to Min result in a kCGSRangeCheck error.
Values are computed by sampling a function for a range of indices from 0 through 1: value = Min + ((Max - Min) * pow(index, Gamma)) The resulting values are converted to a machine specific format and loaded into hardware.
| CGDisplayErr CGCaptureAllDisplays | ( | void | ) |
Capture all displays; this has the nice effect of providing an immersive environment, and preventing other apps from trying to adjust themselves to display changes only needed by your app. CGCaptureAllDisplays()
| void* CGDisplayAddressForPosition | ( | CGDirectDisplayID | display, |
| CGDisplayCoord | x, | ||
| CGDisplayCoord | y | ||
| ) |
return address for X,Y in screen coordinates; (0,0) represents the upper left corner of the display. returns NULL for an invalid display or out of bounds coordinates If the display has not been captured, the returned address may refer to read-only memory. CGDisplayAddressForPosition()
| CFArrayRef CGDisplayAvailableModes | ( | CGDirectDisplayID | display | ) |
Return a CFArray of CFDictionaries describing all display modes. Returns NULL if the display is invalid. CGDisplayAvailableModes()
| void* CGDisplayBaseAddress | ( | CGDirectDisplayID | display | ) |
Returns base address of display or NULL for an invalid display. If the display has not been captured, the returned address may refer to read-only memory. CGDisplayBaseAddress()
| CGBeamPosition CGDisplayBeamPosition | ( | CGDirectDisplayID | display | ) |
Returns the current beam position on the display. If display is invalid, or the display does not implement conventional video vertical and horizontal sweep in painting, or the driver does not implement this functionality, 0 is returned. CGDisplayBeamPosition()
| CFDictionaryRef CGDisplayBestModeForParameters | ( | CGDirectDisplayID | display, |
| size_t | bitsPerPixel, | ||
| size_t | width, | ||
| size_t | height, | ||
| boolean_t * | exactMatch | ||
| ) |
Try to find a display mode of specified depth with dimensions equal or greater than specified. If no depth match is found, try for the next larger depth with dimensions equal or greater than specified. If no luck, then just return the current mode.
exactmatch, if not NULL, is set to 'true' if an exact match in width, height, and depth is found, and 'false' otherwise. Returns NULL if display is invalid. CGDisplayBestModeForParameters()
| CFDictionaryRef CGDisplayBestModeForParametersAndRefreshRate | ( | CGDirectDisplayID | display, |
| size_t | bitsPerPixel, | ||
| size_t | width, | ||
| size_t | height, | ||
| CGRefreshRate | refresh, | ||
| boolean_t * | exactMatch | ||
| ) |
CGDisplayBestModeForParametersAndRefreshRate()
| size_t CGDisplayBitsPerPixel | ( | CGDirectDisplayID | display | ) |
Query parameters for current mode CGDisplayBitsPerPixel()
| size_t CGDisplayBitsPerSample | ( | CGDirectDisplayID | display | ) |
| CGRect CGDisplayBounds | ( | CGDirectDisplayID | display | ) |
Return screen size and origin in global coords; Empty rect if display is invalid CGDisplayBounds()
| size_t CGDisplayBytesPerRow | ( | CGDirectDisplayID | display | ) |
| boolean_t CGDisplayCanSetPalette | ( | CGDirectDisplayID | display | ) |
Palette controls (8 bit pseudocolor only) Returns TRUE if the current display mode supports palettes CGDisplayCanSetPalette()
| CGDisplayErr CGDisplayCapture | ( | CGDirectDisplayID | display | ) |
| CFDictionaryRef CGDisplayCurrentMode | ( | CGDirectDisplayID | display | ) |
Return a CFDictionary describing the current display mode. Returns NULL if display is invalid. CGDisplayCurrentMode()
| CGDisplayErr CGDisplayHideCursor | ( | CGDirectDisplayID | display | ) |
Mouse Cursor controls CGDisplayHideCursor()
| CGOpenGLDisplayMask CGDisplayIDToOpenGLDisplayMask | ( | CGDirectDisplayID | display | ) |
Map a display to an OpenGL display mask; returns 0 on invalid display CGDisplayIDToOpenGLDisplayMask()
| boolean_t CGDisplayIsCaptured | ( | CGDirectDisplayID | display | ) |
Display capture and release CGDisplayIsCaptured()
| CGDisplayErr CGDisplayMoveCursorToPoint | ( | CGDirectDisplayID | display, |
| CGPoint | point | ||
| ) |
decrements hide cursor count
Move the cursor to the specified point relative to the display origin (the upper left corner of the display). Returns CGDisplayNoErr on success. No events are generated as a result of this move. Points that would lie outside the desktop are clipped to the desktop. CGDisplayMoveCursorToPoint()
| size_t CGDisplayPixelsHigh | ( | CGDirectDisplayID | display | ) |
| size_t CGDisplayPixelsWide | ( | CGDirectDisplayID | display | ) |
| CGDisplayErr CGDisplayRelease | ( | CGDirectDisplayID | display | ) |
| void CGDisplayRestoreColorSyncSettings | ( | void | ) |
Restore gamma tables of system displays to the user's ColorSync specified values CGDisplayRestoreColorSyncSettings()
| size_t CGDisplaySamplesPerPixel | ( | CGDirectDisplayID | display | ) |
| CGDisplayErr CGDisplaySetPalette | ( | CGDirectDisplayID | display, |
| CGDirectPaletteRef | palette | ||
| ) |
Set a palette. The current gamma function is applied to the palette elements before being loaded into hardware. CGDisplaySetPalette()
| CGDisplayErr CGDisplayShowCursor | ( | CGDirectDisplayID | display | ) |
increments hide cursor count CGDisplayShowCursor()
| CGDisplayErr CGDisplaySwitchToMode | ( | CGDirectDisplayID | display, |
| CFDictionaryRef | mode | ||
| ) |
Switch display mode. Note that after switching, display parameters and addresses may change. The selected display mode persists for the life of the program, and automatically reverts to the permanent setting made by Preferences when the program terminates. The mode dictionary passed in must be a dictionary vended by other CGDirectDisplay APIs such as CGDisplayBestModeForParameters() and CGDisplayAvailableModes(). CGDisplaySwitchToMode()
| CGDisplayErr CGDisplayWaitForBeamPositionOutsideLines | ( | CGDirectDisplayID | display, |
| CGBeamPosition | upperScanLine, | ||
| CGBeamPosition | lowerScanLine | ||
| ) |
Wait until the beam position is outside the range specified by upperScanLine and lowerScanLine. Note that if upperScanLine and lowerScanLine encompass the entire display height, the function returns an error. lowerScanLine must be greater than or equal to upperScanLine.
Some display systems may not conventional video vertical and horizontal sweep in painting. These displays report a kCGDisplayRefreshRate of 0 in the CFDictionaryRef returned by CGDisplayCurrentMode(). On such displays, this function returns at once.
Some drivers may not implement support for this mechanism. On such displays, this function returns at once.
Returns CGDisplayNoErr on success, and an error if display or upperScanLine and lowerScanLine are invalid.
The app should set the values of upperScanLine and lowerScanLine to allow enough lead time for the drawing operation to complete. A common strategy is to wait for the beam to pass the bottom of the drawing area, allowing almost a full vertical sweep period to perform drawing. To do this, set upperScanLine to 0, and set lowerScanLine to the bottom of the bounding box: lowerScanLine = (CGBeamPosition)(cgrect.origin.y + cgrect.size.height);
IOKit may implement this as a spin-loop on the beam position call used for CGDisplayBeamPosition(). On such system the function is CPU bound, and subject to all the usual scheduling pre-emption. In particular, attempting to wait for the beam to hit a specific scanline may be an exercise in frustration.
These functions are advisary in nature, and depend on IOKit and hardware specific drivers to implement support. If you need extremely precise timing, or access to vertical blanking interrupts, you should consider writing a device driver to tie into hardware-specific capabilities. CGDisplayWaitForBeamPositionOutsideLines()
| CGDisplayErr CGGetActiveDisplayList | ( | CGDisplayCount | maxDisplays, |
| CGDirectDisplayID * | activeDspys, | ||
| CGDisplayCount * | dspyCnt | ||
| ) |
Get lists of displays. Use this to determine display IDs
If the activeDspys array is NULL, maxDisplays is ignored, and *dspyCnt is filled in with the number of displays meeting the function's requirements.
The first display returned in the list is the main display, the one with the menu bar. When mirroring, this will be the largest display, or if all are the same size, the one with the deepest pixel depth. CGGetActiveDisplayList()
| CGDisplayErr CGGetDisplaysWithOpenGLDisplayMask | ( | CGOpenGLDisplayMask | mask, |
| CGDisplayCount | maxDisplays, | ||
| CGDirectDisplayID * | dspys, | ||
| CGDisplayCount * | dspyCnt | ||
| ) |
CGGetDisplaysWithOpenGLDisplayMask()
| CGDisplayErr CGGetDisplaysWithPoint | ( | CGPoint | point, |
| CGDisplayCount | maxDisplays, | ||
| CGDirectDisplayID * | dspys, | ||
| CGDisplayCount * | dspyCnt | ||
| ) |
Mechanisms used to find screen IDs An array length (maxDisplays) and array of CGDirectDisplayIDs are passed in. Up to maxDisplays of the array are filled in with the displays meeting the specified criteria. The actual number of displays filled in is returned in dspyCnt.
If the dspys array is NULL, maxDisplays is ignored, and *dspyCnt is filled in with the number of displays meeting the function's requirements. CGGetDisplaysWithPoint()
| CGDisplayErr CGGetDisplaysWithRect | ( | CGRect | rect, |
| CGDisplayCount | maxDisplays, | ||
| CGDirectDisplayID * | dspys, | ||
| CGDisplayCount * | dspyCnt | ||
| ) |
| CGDisplayErr CGGetDisplayTransferByFormula | ( | CGDirectDisplayID | display, |
| CGGammaValue * | redMin, | ||
| CGGammaValue * | redMax, | ||
| CGGammaValue * | redGamma, | ||
| CGGammaValue * | greenMin, | ||
| CGGammaValue * | greenMax, | ||
| CGGammaValue * | greenGamma, | ||
| CGGammaValue * | blueMin, | ||
| CGGammaValue * | blueMax, | ||
| CGGammaValue * | blueGamma | ||
| ) |
CGGetDisplayTransferByFormula()
| CGDisplayErr CGGetDisplayTransferByTable | ( | CGDirectDisplayID | display, |
| CGTableCount | capacity, | ||
| CGGammaValue * | redTable, | ||
| CGGammaValue * | greenTable, | ||
| CGGammaValue * | blueTable, | ||
| CGTableCount * | sampleCount | ||
| ) |
Get transfer tables. Capacity should contain the number of samples each array can hold, and *sampleCount is filled in with the number of samples actually copied in. CGGetDisplayTransferByTable()
| void CGGetLastMouseDelta | ( | CGMouseDelta * | deltaX, |
| CGMouseDelta * | deltaY | ||
| ) |
Report the mouse position change associated with the last mouse move event recieved by this application. CGGetLastMouseDelta()
| CGDisplayErr CGReleaseAllDisplays | ( | void | ) |
Release all captured displays, and restore the display modes to the user's preferences. May be used in conjunction with CGDisplayCapture() or CGCaptureAllDisplays(). CGReleaseAllDisplays()
| CGDisplayErr CGSetDisplayTransferByByteTable | ( | CGDirectDisplayID | display, |
| CGTableCount | tableSize, | ||
| const CGByteValue * | redTable, | ||
| const CGByteValue * | greenTable, | ||
| const CGByteValue * | blueTable | ||
| ) |
As a convenience, allow setting of the gamma table by byte values CGSetDisplayTransferByByteTable()
| CGDisplayErr CGSetDisplayTransferByFormula | ( | CGDirectDisplayID | display, |
| CGGammaValue | redMin, | ||
| CGGammaValue | redMax, | ||
| CGGammaValue | redGamma, | ||
| CGGammaValue | greenMin, | ||
| CGGammaValue | greenMax, | ||
| CGGammaValue | greenGamma, | ||
| CGGammaValue | blueMin, | ||
| CGGammaValue | blueMax, | ||
| CGGammaValue | blueGamma | ||
| ) |
CGSetDisplayTransferByFormula()
| CGDisplayErr CGSetDisplayTransferByTable | ( | CGDirectDisplayID | display, |
| CGTableCount | tableSize, | ||
| const CGGammaValue * | redTable, | ||
| const CGGammaValue * | greenTable, | ||
| const CGGammaValue * | blueTable | ||
| ) |
Set a display gamma/transfer function using tables of data for each channel. Values within each table should have values in the range of 0.0 through 1.0. The same table may be passed in for red, green, and blue channels. 'tableSize' indicates the number of entries in each table. The tables are interpolated as needed to generate the number of samples needed by hardware. CGSetDisplayTransferByTable()
| void* CGShieldingWindowID | ( | CGDirectDisplayID | display | ) |
Returns CoreGraphics raw shield window ID or NULL if not shielded This value may be used with drawing surface APIs. CGShieldingWindowID()
| int32_t CGShieldingWindowLevel | ( | void | ) |
Returns the window level used for the shield window. This value may be used with Cocoa windows to position the Cocoa window in the same window level as the shield window. CGShieldingWindowLevel()
|
extern |
kCGDisplayBitsPerPixel
|
extern |
kCGDisplayBitsPerSample
|
extern |
kCGDisplayHeight
|
extern |
kCGDisplayIOFlags
|
extern |
kCGDisplayMode
|
extern |
kCGDisplayModeUsableForDesktopGUI
|
extern |
kCGDisplayRefreshRate
|
extern |
kCGDisplaySamplesPerPixel
|
extern |
Display mode selection Display modes are represented as CFDictionaries All dictionaries and arrays returned via these mechanisms are owned by the framework and should not be released. The framework will not release them out from under your application.
Values associated with the following keys are CFNumber types. With CFNumberGetValue(), use kCFNumberLongType for best results. Keys used in mode dictionaries. Source C strings shown won't change. Some CFM environments cannot import data variables, and so duplicate these CFStringRefs locally. kCGDisplayWidth