Class DisplayComponent
Inherited Members
Namespace: OpenTK.Platform.Native.Windows
Assembly: OpenTK.Platform.dll
Syntax
public class DisplayComponent : IDisplayComponent, IPalComponent
Properties
CanGetVirtualPosition
True if the driver can get the virtual position of the display using GetVirtualPosition(DisplayHandle, out int, out int).
Declaration
public bool CanGetVirtualPosition { get; }
Property Value
Type | Description |
---|---|
bool |
Logger
The logger that this component uses to log diagnostic messages.
Declaration
public ILogger? Logger { get; set; }
Property Value
Type | Description |
---|---|
ILogger |
See Also
Name
Name of the abstraction layer component.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
string |
Provides
Specifies which PAL components this object provides.
Declaration
public PalComponents Provides { get; }
Property Value
Type | Description |
---|---|
PalComponents |
Methods
Close(DisplayHandle)
Close a display handle.
Declaration
public void Close(DisplayHandle handle)
Parameters
Type | Name | Description |
---|---|---|
DisplayHandle | handle | Handle to a display. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
GetAdapter(DisplayHandle)
Returns the win32 adapter string associated with this display.
Declaration
public string GetAdapter(DisplayHandle handle)
Parameters
Type | Name | Description |
---|---|---|
DisplayHandle | handle | A handle to a display to get the adapter name for. |
Returns
Type | Description |
---|---|
string | The win32 adapter name for the display. |
GetDisplayCount()
Get the number of available displays.
Declaration
public int GetDisplayCount()
Returns
Type | Description |
---|---|
int | Number of displays available. |
GetDisplayScale(DisplayHandle, out float, out float)
Get the scale of the display.
Declaration
public void GetDisplayScale(DisplayHandle handle, out float scaleX, out float scaleY)
Parameters
Type | Name | Description |
---|---|---|
DisplayHandle | handle | Handle to a display. |
float | scaleX | The X-axis scale of the monitor. |
float | scaleY | The Y-axis scale of the monitor. |
GetMonitor(DisplayHandle)
Returns the win32 mointor device name string associated with this display.
Declaration
public string GetMonitor(DisplayHandle handle)
Parameters
Type | Name | Description |
---|---|---|
DisplayHandle | handle | A handle to a display to get the monitor name for. |
Returns
Type | Description |
---|---|
string | The win32 monitor name for the display. |
GetName(DisplayHandle)
Get the friendly name of a display.
Declaration
public string GetName(DisplayHandle handle)
Parameters
Type | Name | Description |
---|---|---|
DisplayHandle | handle | Handle to a display. |
Returns
Type | Description |
---|---|
string | Display name. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
GetRefreshRate(DisplayHandle, out float)
Get the refresh rate if the specified display.
Declaration
public void GetRefreshRate(DisplayHandle handle, out float refreshRate)
Parameters
Type | Name | Description |
---|---|---|
DisplayHandle | handle | Handle to a display. |
float | refreshRate | The refresh rate of the display. |
GetResolution(DisplayHandle, out int, out int)
Get the resolution of the specified display.
Declaration
public void GetResolution(DisplayHandle handle, out int width, out int height)
Parameters
Type | Name | Description |
---|---|---|
DisplayHandle | handle | Handle to a display. |
int | width | The horizontal resolution of the display. |
int | height | The vertical resolution of the display. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
GetSupportedVideoModes(DisplayHandle)
Get all supported video modes for a specific display.
Declaration
public VideoMode[] GetSupportedVideoModes(DisplayHandle handle)
Parameters
Type | Name | Description |
---|---|---|
DisplayHandle | handle | Handle to a display. |
Returns
Type | Description |
---|---|
VideoMode[] | An array of all supported video modes. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
GetVideoMode(DisplayHandle, out VideoMode)
Get the active video mode of a display.
Declaration
public void GetVideoMode(DisplayHandle handle, out VideoMode mode)
Parameters
Type | Name | Description |
---|---|---|
DisplayHandle | handle | Handle to a display. |
VideoMode | mode | Active video mode of display. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
GetVirtualPosition(DisplayHandle, out int, out int)
Get the position of the display in the virtual desktop.
Declaration
public void GetVirtualPosition(DisplayHandle handle, out int x, out int y)
Parameters
Type | Name | Description |
---|---|---|
DisplayHandle | handle | Handle to a display. |
int | x | Virtual X coordinate of the display. |
int | y | Virtual Y coordinate of the display. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
PalNotImplementedException | Driver cannot get display virtual position. See CanGetVirtualPosition. |
GetWorkArea(DisplayHandle, out Box2i)
Get the work area of this display. The work area is the area of the display that is not covered by task bars or menu bars.
Declaration
public void GetWorkArea(DisplayHandle handle, out Box2i area)
Parameters
Type | Name | Description |
---|---|---|
DisplayHandle | handle | Handle to a display. |
Box2i | area | The work area of the display. |
Initialize(ToolkitOptions)
Initialize the component.
Declaration
public void Initialize(ToolkitOptions options)
Parameters
Type | Name | Description |
---|---|---|
ToolkitOptions | options | The options to initialize the component with. |
See Also
IsPrimary(DisplayHandle)
Checks if a display is the primary display or not.
Declaration
public bool IsPrimary(DisplayHandle handle)
Parameters
Type | Name | Description |
---|---|---|
DisplayHandle | handle | The display to check whether or not is the primary display. |
Returns
Type | Description |
---|---|
bool | If this display is the primary display. |
Open(int)
Create a display handle to the indexed display.
Declaration
public DisplayHandle Open(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The display index to create a display handle to. |
Returns
Type | Description |
---|---|
DisplayHandle | Handle to the display. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
OpenPrimary()
Create a display handle to the primary display.
Declaration
public DisplayHandle OpenPrimary()
Returns
Type | Description |
---|---|
DisplayHandle | Handle to the primary display. |
Uninitialize()
Uninitialize the component. Frees any native resources used by the component.
Declaration
public void Uninitialize()