Platforms to show: All Mac Windows Linux Cross-Platform

Back to CGDisplayMBS class.

CGDisplayMBS.CaptureAllDisplays as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 3.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Capture all displays.
Example
dim d as CGDisplayMBS = CGDisplayMBS.MainDisplay

if d.CaptureAllDisplays = 0 then

dim c as CGContextMBS = d.DrawingContext

// watch it drawing red
c.SetRGBFillColor 1.0, 0.0, 0.0, 1.0
c.FillRect CGMakeRectMBS(0,0,d.PixelsWide,d.PixelsHigh)

DelayMBS 3.0

call d.ReleaseAllDisplays
else
MsgBox "Failed to capture displays."
end if

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.

Returns an error code.

Some examples using this method:

CGDisplayMBS.CaptureAllDisplaysWithOptions(options as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Capture all displays.
Example
dim d as CGDisplayMBS = CGDisplayMBS.MainDisplay

if d.CaptureAllDisplaysWithOptions(d.kCGCaptureNoOptions) = 0 then

dim c as CGContextMBS = d.DrawingContext

// watch it drawing red
c.SetRGBFillColor 1.0, 0.0, 0.0, 1.0
c.FillRect CGMakeRectMBS(0,0,d.PixelsWide,d.PixelsHigh)

DelayMBS 3.0

call d.ReleaseAllDisplays
else
MsgBox "Failed to capture displays."
end if

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.

Use kCGCaptureNoOptions and kCGCaptureNoFill for options parameter.
Returns an error code.

CGDisplayMBS.GetActiveDisplayList as CGDisplayMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns an array with the active displays.
Example
// List all displays in a 2 column listbox:

Listbox1.DeleteAllRows

for each d as CGDisplayMBS in CGDisplayMBS.GetActiveDisplayList

Listbox1.AddRow hex(d.Handle)
Listbox1.cell(Listbox1.LastIndex,1)=str(d.PixelsWide)+" x "+str(d.PixelsHigh)

next

Returns an empty array on any error.

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.

This function was named CGGetActiveDisplayListMBS in older plugin versions.

Some examples using this method:

CGDisplayMBS.GetDisplaysWithOpenGLDisplayMask(mask as Integer) as CGDisplayMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Find all displays for the given OpenGL mask.

Returns an empty array on any error.

CGDisplayMBS.GetDisplaysWithPoint(cgpoint as CGPointMBS) as CGDisplayMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns an array of CGDisplayMBS objects who are visible at the point on the virtual screen.
Example
// List all displays in a 2 column listbox which match the point:

Listbox1.DeleteAllRows

dim p as CGPointMBS = CGMakePointMBS(100,100)
for each d as CGDisplayMBS in CGDisplayMBS.GetDisplaysWithPoint(p)

Listbox1.AddRow hex(d.Handle)
Listbox1.cell(Listbox1.LastIndex,1)=str(d.PixelsWide)+" x "+str(d.PixelsHigh)

next

Returns an empty array on any error.

This function was called CGGetDisplaysWithPointMBS in older plugin versions.

See also:

CGDisplayMBS.GetDisplaysWithPoint(x as Double, y as Double) as CGDisplayMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns an array of CGDisplayMBS objects who are visible at the point on the virtual screen.
Example
// List all displays in a 2 column listbox which match the point:

Listbox1.DeleteAllRows

for each d as CGDisplayMBS in CGDisplayMBS.GetDisplaysWithPoint(100,100)

Listbox1.AddRow hex(d.Handle)
Listbox1.cell(Listbox1.LastIndex,1)=str(d.PixelsWide)+" x "+str(d.PixelsHigh)

next

Returns an empty array on any error.

This function was called CGGetDisplaysWithPointMBS in older plugin versions.

See also:

CGDisplayMBS.GetDisplaysWithRect(cgrect as CGRectMBS) as CGDisplayMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns an array of CGDisplayMBS objects who are visible within the rectangle on the virtual screen.
Example
// List all displays in a 2 column listbox which match the rectangle:

Listbox1.DeleteAllRows

dim p as CGRectMBS = CGMakeRectMBS(100,100,100,100)
for each d as CGDisplayMBS in CGDisplayMBS.GetDisplaysWithRect(p)

Listbox1.AddRow hex(d.Handle)
Listbox1.cell(Listbox1.LastIndex,1)=str(d.PixelsWide)+" x "+str(d.PixelsHigh)

next

Returns an empty array on any error.
This function was called CGGetDisplaysWithRectMBS in older plugin versions.

See also:

CGDisplayMBS.GetDisplaysWithRect(x as Double, y as Double, w as Double, h as Double) as CGDisplayMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns an array of CGDisplayMBS objects who are visible within the rectangle on the virtual screen.
Example
// List all displays in a 2 column listbox which match the rectangle:

Listbox1.DeleteAllRows

for each d as CGDisplayMBS in CGDisplayMBS.GetDisplaysWithRect(100,100,100,100)

Listbox1.AddRow hex(d.Handle)
Listbox1.cell(Listbox1.LastIndex,1)=str(d.PixelsWide)+" x "+str(d.PixelsHigh)

next

Returns an empty array on any error.
This function was called CGGetDisplaysWithRectMBS in older plugin versions.

See also:

CGDisplayMBS.GetLastMouseDelta(byref deltax as Integer, byref deltay as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 3.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Report the mouse position change associated with the last mouse move event recieved by this application.

CGDisplayMBS.GetOnlineDisplayList as CGDisplayMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns an array with the online displays.
Example
// List all online displays in a 2 column listbox:

Listbox1.DeleteAllRows

for each d as CGDisplayMBS in CGDisplayMBS.GetOnlineDisplayList

Listbox1.AddRow hex(d.Handle)
Listbox1.cell(Listbox1.LastIndex,1)=str(d.PixelsWide)+" x "+str(d.PixelsHigh)

next

Returns an empty array on any error.

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.

With hardware mirroring, a display may be on-line, but not necessarily active, or drawable. Programs which manipulate display settings such as the palette or gamma tables need access to all displays in use, including hardware mirrors which are not drawable.

This function was named CGGetOnlineDisplayListMBS in older plugin versions.

CGDisplayMBS.ReleaseAllDisplays as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 3.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Release all captured displays.
Example
dim d as CGDisplayMBS = CGDisplayMBS.MainDisplay

if d.CaptureAllDisplays = 0 then

dim c as CGContextMBS = d.DrawingContext

// watch it drawing red
c.SetRGBFillColor 1.0, 0.0, 0.0, 1.0
c.FillRect CGMakeRectMBS(0,0,d.PixelsWide,d.PixelsHigh)

DelayMBS 3.0

call d.ReleaseAllDisplays
else
MsgBox "Failed to capture displays."
end if

Release all captured displays, and restore the display modes to the user's preferences. May be used in conjunction with Capture or CaptureAllDisplays.

Some examples using this method:

CGDisplayMBS.RestoreColorSyncSettings

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 3.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Restore gamma tables of system displays to the user's ColorSync specified values.

CGDisplayMBS.ShieldingWindowLevel as Int32

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the window level of the shield window for the captured display.

The items on this page are in the following plugins: MBS MacCG Plugin.


The biggest plugin in space...