Platforms to show: All Mac Windows Linux Cross-Platform
Back to CGDisplayMBS class.
CGDisplayMBS.AllDisplayModes(Options as Dictionary = nil) as CGDisplayModeMBS()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 11.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Returns an empty array on any error.
Requires Mac OS X 10.6
CGDisplayMBS.AvailableModes as Dictionary()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Returns empty error on any error.
Some examples using this method:
CGDisplayMBS.BestModeForParameters(BitsPerPixel as Integer, Width as Integer, Height as Integer, byref ExactMatch as boolean) as Dictionary
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Returns nil on any error.
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 is set to 'true' if an exact match in width, height, and depth is found, and 'false' otherwise.
Returns nil if display is invalid.
CGDisplayMBS.BestModeForParametersAndRefreshRate(BitsPerPixel as Integer, Width as Integer, Height as Integer, RefreshRate as Integer, byref ExactMatch as boolean) as Dictionary
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Returns nil on any error.
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 is set to 'true' if an exact match in width, height, and depth is found, and 'false' otherwise.
Returns nil if display is invalid.
CGDisplayMBS.BestModeForParametersAndRefreshRateWithProperty(BitsPerPixel as Integer, Width as Integer, Height as Integer, RefreshRate as Integer, propertyName as string, byref ExactMatch as boolean) as Dictionary
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 11.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Returns nil on any error.
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 is set to 'true' if an exact match in width, height, and depth is found, and 'false' otherwise.
Returns nil if display is invalid.
CGDisplayMBS.Capture as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Don't forget to Release the display later.
Returns an error code.
CGDisplayMBS.CaptureWithOptions(options as Integer) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 11.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Don't forget to Release the display later.
Returns an error code.
Use kCGCaptureNoOptions and kCGCaptureNoFill for options parameter.
CGDisplayMBS.CreateImage as CGImageMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 11.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Requires Mac OS X 10.6.
CGDisplayMBS.CreateImageAsync(receiverDelegate as CreateImageAsyncDelegateMBS, jpegQuality as Double = 0.9, tag as Variant = nil)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 15.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
If jpeg is >= 0, we use it as quality for the jpeg compression and provide the JPEG data as memoryblock in the delegate.
Tag is passed through as is.
Delegate declaration:
CreateImageAsyncDelegateMBS(img as CGImageMBS, JPEGData as MemoryBlock, Tag as Variant)
Some examples using this method:
CGDisplayMBS.CreateImageForRect(rect as CGRectMBS) as CGImageMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 11.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
The actual rectangle used is the rectangle returned from CGRectIntegral(rect).
Requires Mac OS X 10.6.
Some examples using this method:
CGDisplayMBS.DrawingContext as CGContextMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 11.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
The context is owned by the device and should not be released by the caller.
The context remains valid while the display is captured and while the display configuration is unchanged. Releasing the captured display or reconfiguring the display invalidates the drawing context.
The determine when the display configuration is changing, use
CGDisplayReconfigurationEventMBS class.
Some examples using this method:
CGDisplayMBS.GetDisplayTransferByTable(capacity as Integer, red as memoryblock, green as memoryblock, blue as memoryblock, byref samplecount as Integer) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Capacity should contain the number of samples each array can hold, and sampleCount is filled in with the number of samples actually copied in.
You must pass in Memoryblocks with the given size (capacity*4 Bytes).
Returns an error code.
CGDisplayMBS.GetDisplayTransferFormula(byref formula as CGDisplayTransferFormulaMBS) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Returns an error code.
Some examples using this method:
CGDisplayMBS.HideCursor as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Returns an error code.
Decrements hide cursor count.
CGDisplayMBS.Info as Dictionary
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 8.6 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
On any error the return value is nil.
This function leaks around 4 to 16 KB of memory on Mac OS X 10.4. Not in the versions 10.3 or 10.5.
CGDisplayMBS.InfoAsCFDictionary as Variant
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 14.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
On any error the return value is nil.
Returns a CFDictionaryMBS object. Returned as Variant to reduce plugin dependencies.
CGDisplayMBS.IsCaptured as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
CGDisplayMBS.MoveCursorToPoint(x as Double, y as Double) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Returns CGDisplayNoErr (0) on success.
No events are generated as a result of this move.
Points that would lie outside the desktop are clipped to the desktop.
CGDisplayMBS.OpenGLDisplayMask as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 11.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
CGDisplayMBS.Release as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Returns an error code.
CGDisplayMBS.SetDisplayMode(mode as CGDisplayModeMBS) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 11.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
The selected display mode persists for the life of the program, and automatically reverts to the permanent setting when the program terminates.
When changing display modes of displays in a mirroring set, other displays in the mirroring set will be set to a display mode capable of mirroring the bounds of the largest display being explicitly set.
Note that after switching, display parameters and addresses may change.
CGDisplayMBS.SetDisplayTransferByByteTable(count as Integer, red as memoryblock, green as memoryblock, blue as memoryblock) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
As a convenience, allow setting of the gamma table by byte values.
Returns an error code.
CGDisplayMBS.SetDisplayTransferByTable(count as Integer, red as memoryblock, green as memoryblock, blue as memoryblock) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
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. 'count' indicates the number of entries in each table.
The tables are interpolated as needed to generate the number of samples needed by hardware.
Returns an error code.
CGDisplayMBS.SetDisplayTransferFormula(formula as CGDisplayTransferFormulaMBS) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
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.
Returns an error code.
Some examples using this method:
CGDisplayMBS.SetRotation(angle as Integer) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 13.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Returns IOKit error code. Zero means success.
Lasterror is set.
CGDisplayMBS.SetStereoOperation(stereo as boolean, forceBlueLine as boolean, option as Integer) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 11.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Note that the system normally detects the presence of a stereo window, and will automatically switch a display containing a stereo window to stereo operation. This function provides a mechanism to force a display to stereo operation, and to set options (such as blue line sync signal) when in stereo operation.
When in stereo operation, a display may need to generate a special stereo sync signal as part of the video output. The sync signal consists of a blue line which occupies the first 25% of the last scanline for the left eye view, and the first 75% of the last scanline for the right eye view. The remainder of the scanline is black. To force the display to generate this sync signal, pass true for forceBlueLine; otherwise, pass false.
Lasterror is set to kCGErrorSuccess on success, or kCGErrorRangeCheck if the display does not support the stereo operation settings requested.
On success, the display resolution, mirroring mode, and available display modes may change due to hardware-specific capabilities and limitations. You should check these settings to verify that they are appropriate for your application.
Lasterror is set.
CGDisplayMBS.ShieldingWindowID as UInt32
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 11.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
CGDisplayMBS.ShowCursor as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Returns an error code.
Increments hide cursor count.
Some examples using this method:
CGDisplayMBS.SwitchToMode(Mode as Dictionary) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
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 BestModeForParameters() and AvailableModes().
Returns an error code.
Some examples using this method:
CGDisplayMBS.WaitForBeamPositionOutsideLines(upperScanLine as UInt32, lowerScanLine as UInt32) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
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 CurrentMode(). 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 BeamPosition().
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.
Returns an error code.
The items on this page are in the following plugins: MBS MacCG Plugin.