Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

DisplayMBS.CanDepth(depth as Integer) As Boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Resolution MBS Util Plugin Yes Yes No No No
Function: Returns true if the monitor supports the given color depth at the current ResolutionMBS.
Notes: none.

Feedback, Comments & Corrections

DisplayCountMBS as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Resolution MBS Util Plugin Yes Yes No No No
Function: DisplayCount returns the number of displays connected.
Example:
msgbox "You have "+str(DisplayCountMBS)+" screens."

Some examples using this method:

Feedback, Comments & Corrections

DisplayMBS.FadeGamma(intensity as Integer, col As Color)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Resolution MBS Util Plugin Yes Yes No No No
Function: Sets the gamma of the DisplayMBS
Notes:
Intensity has to be between 0 and 1000. 1000 is normal, when it is 0, the whole DisplayMBS is in the color GammaColor.
Direct color display modes do not use color lookup tables and are usually 16, 24, or 32 bit. Not all direct color video boards support loadable gamma ramps.

See the NativeGamma documentation for more details on Windows Gamma details.

Feedback, Comments & Corrections

DisplayMBS.FadeGammaTo(intensity as Integer, col As Color, ticks as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Resolution MBS Util Plugin Yes Yes No No No
Function: Fades the intensity and color of the gamma slowly in the given number of milliseconds.
Notes:
Intensity has to be between 0 and 1000. 1000 is normal, when it is 0, the whole display is in the color GammaColor.
Direct color display modes do not use color lookup tables and are usually 16, 24, or 32 bit. Not all direct color video boards support loadable gamma ramps.
See the NativeGamma documentation for more details on Windows Gamma details.

Feedback, Comments & Corrections

DisplayMBS.GetBestResolution(width as Integer, height as Integer, depth as Integer, safe As Boolean) As ResolutionMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Resolution MBS Util Plugin Yes Yes No No No
Function: Searches for the best matching resolution.
Notes:
Returns the best resolution which size is not smaller that the dimensions given, which has the given depth and, if safe is true, which is safe. If safe is not true, be sure that the frequency works, if you want to switch to it (for example by asking the user).
On Mac OS X till now no resolution can be called safe.

See also:

Feedback, Comments & Corrections

DisplayMBS.GetBestResolution(width as Integer, height as Integer, safe As Boolean) As ResolutionMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Resolution MBS Util Plugin Yes Yes No No No
Function: Searches for the best matching resolution.
Notes:
Returns the best resolution which size is not smaller that the dimensions given, which has the highest depth and, if safe is true, which is safe. If safe is not true, be sure that the frequency works, if you want to switch to it (for example by asking the user).
On Mac OS X till now no resolution can be called safe.

See also:

Feedback, Comments & Corrections

DisplayMBS.GetCurrentResolution As ResolutionMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Resolution MBS Util Plugin Yes Yes No No No
Function: Returns the current resolution.
Notes: Returns the resolution the display is currently set to. This is useful if you want to switch back to the old resolution after you switched to another resolution.

Feedback, Comments & Corrections

GetDisplayMBS(num as Integer) As DisplayMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Resolution MBS Util Plugin Yes Yes No No No
Function: Returns an object of class DisplayMBS for the given DisplayMBS.
Example:
dim d as DisplayMBS

d=GetDisplayMBS(0)
msgBox str(d.width)+" x "+str(d.height)+" @ "+str(pow(2,d.depth))+" colors"
Notes: num must be: 0 <= num < displaycount

Some examples using this method:

Feedback, Comments & Corrections

DisplayMBS.GetLargestResolution(depth as Integer, safe As Boolean) As ResolutionMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Resolution MBS Util Plugin Yes Yes No No No
Function: Searches for the largest resolution with the given depth.
Notes:
The same as GetBestResolution(width, height, depth, safe), the only difference is that it does not search for the smallest resolution but for the biggest one.
On Mac OS X till now no resolution can be called safe.

See also:

Feedback, Comments & Corrections

DisplayMBS.GetLargestResolution(safe As Boolean) As ResolutionMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Resolution MBS Util Plugin Yes Yes No No No
Function: Searches for the largest resolution.
Notes:
If safe is true, this method returns only safe resolutions.
On Mac OS X till now no resolution can be called safe.

See also:

Feedback, Comments & Corrections

DisplayMBS.GetResolution(num as Integer) As ResolutionMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Resolution MBS Util Plugin Yes Yes No No No
Function: Returns a resolution.
Notes: Num has to be between 0 and ResolutionCount(safe)-1.

Feedback, Comments & Corrections

DisplayMBS.NativeGamma as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Resolution MBS Util Plugin 3.0 Yes Yes No No No
Function: The native gamma values.
Example:
dim d as DisplayMBS // your display
d.nativegamma=newmemoryblock(3072) // all black
Notes:
3072 bytes big is this array a 256 RGB values saved in 3 single properties.

Some notes for SetDeviceGammaRamp, which is the Windows function used by the plugin:

SetDeviceGammaRamp doesn't allow all gamma ramps. It checks the gamma ramp; if it is too complex, such as the red flash when the player is shot in Quake, it rejects it.
SetDeviceGammaRamp will not currently make use of a gamma calibrator. This may change in future versions of Image Color Management (ICM), but for Windows 2000, only the DirectDraw API supports the gamma calibrators.
The existing gamma entry points is already used by GetDeviceGammaRamp and SetDeviceGammaRamp. Therefore, the display driver doesn't need to do anything special to support this new interface, as long as it already supports the Win32 Get/SetDeviceGammaRamp functions.
In addition to getting and setting gamma ramps, the new DirectDraw interface allows the new gamma ramp to be calibrated—if a gamma calibrator is installed. The mechanism that DirectDraw uses to register and communicate with the gamma calibrator is an interim mechanism that will be changed in future releases.
DirectDraw looks for an installed software calibrator and passes the gamma value to the software calibrator; the software calibrator in turn adjusts the gamma ramp according to the measured response of the monitor. The calibrator passes the gamma ramp back to DirectDraw, which passes it to the SetDeviceGammaRamp device driver interface (DDI). The result is that the game looks as intended.
For DirectDraw to use the gamma calibrator, the calibrator must register itself with DirectDraw using a registry key; DirectDraw will call it if the application wants the gamma ramp to be calibrated.
In the future, both the method by which DirectDraw communicates with the gamma calibrator, through the DDI, and the method gamma calibrators use to register themselves in the registry will change. But every part of the DirectDraw API is permanent.
ICM is the color management system in Windows; all system-level color management should be handled by ICM. For this reason, downloadable gamma ramp support will be rolled into ICM in the future, making current solutions for gamma calibrators obsolete. Until such time, we have provided a method by which applications can take advantage of the installed base of software calibrators and graphics adapters that support downloadable gamma ramps.
(Read and Write computed property)

Feedback, Comments & Corrections

DisplayMBS.ResolutionCount(depth as Integer, safe As Boolean) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Resolution MBS Util Plugin Yes Yes No No No
Function: Returns the number of resolutions for a given depth.
Notes:
This method returns the number of resolutions that have the given depth and, if safe is true, which are safe.
On Mac OS X till now no ResolutionMBS can be called safe.

See also:

Feedback, Comments & Corrections

DisplayMBS.ResolutionCount(safe As Boolean) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Resolution MBS Util Plugin Yes Yes No No No
Function: Returns the number of resolutions.
Notes:
This method returns the total number of resolutions this monitor supports and, if safe is true, which are safe. Safe resolutions are resolutions which will always work.
On Mac OS X till now no ResolutionMBS can be called safe.

See also:

Feedback, Comments & Corrections

DisplayMBS.SetDepth(depth as Integer) As Boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Resolution MBS Util Plugin Yes Yes No No No
Function: Switches the color depth to the depth given. Returns true if attempt was successful.
Notes: none.

Feedback, Comments & Corrections

DisplayMBS.SwitchTo(width as Integer, height as Integer, depth as Integer, safe As Boolean) As Boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Resolution MBS Util Plugin Yes Yes No No No
Function: Switches to the given ResolutionMBS if possible.
Notes:
This method tries to switch directly to the best ResolutionMBS which size is bigger or the same as the given dimensions and which depth is the same as the given parameter. It returnes true if it was successful. Try this function first with safe set to true. If that fails, try again with false, but after that show a dialog asking the user if that ResolutionMBS is okay. If the user presses escape or clicks cancel, you should immediatly switch back to the old ResolutionMBS.
On Mac OS X till now no ResolutionMBS can be called safe.

Feedback, Comments & Corrections

DisplayMBS.Update
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Resolution MBS Util Plugin 3.1 Yes Yes No No No
Function: Updates the properties in this class.
Notes:
Call it whenever you detect a screen resolution change to update the content of this class.
In general you should not keep DisplayMBS classes around too long because the display described may go away (one a Powerbook the external display).

Feedback, Comments & Corrections

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




Links
MBS Xojo tutorial videos