Table of Contents

Class DisplayMode

Namespace
Sdl3Sharp.Video.Windowing
Assembly
Sdl3Sharp.dll

Represents a display mode for a specific Display

public abstract class DisplayMode : ISpanFormattable, IFormattable
Inheritance
DisplayMode
Implements
Inherited Members

Properties

Display

Gets the Display associated with this display mode

public Display? Display { get; }

Property Value

Display

The Display associated with this display mode, or null if this display mode is invalid

Remarks

The value of this property will only be null if this display mode is invalid.

Format

Gets the pixel format of this display mode

public PixelFormat Format { get; }

Property Value

PixelFormat

The pixel format of this display mode

Height

Gets the logical height of this display mode

public int Height { get; }

Property Value

int

The logical height of this display mode, in logical pixels

Remarks

To convert the value of this property into actual device pixels, you can multiply it by the value of the PixelDensity property.

PixelDensity

Gets the scale factor for converting logical pixels into actual device pixels for this display mode

public float PixelDensity { get; }

Property Value

float

The scale factor for converting logical pixels into actual device pixels for this display mode

Remarks

You can multiply the values of the Width and Height properties by the value of this property to get the actual device pixel dimensions of this display mode.

RefreshRate

Gets the refresh rate of this display mode

public float RefreshRate { get; }

Property Value

float

The refresh rate of this display mode, in Hz (hertz), or 0 if the refresh rate is unknown or unspecified

RefreshRateRatio

Gets the refresh rate of this display mode as a ratio of two integers

public (int Numerator, int Denominator) RefreshRateRatio { get; }

Property Value

(int Width, int Height)

The refresh rate of this display mode as a ratio of two integers, where the first integer (the numerator) can be 0 to indicate an unknown or unspecified refresh rate

Width

Gets the logical width of this display mode

public int Width { get; }

Property Value

int

The logical width of this display mode, in logical pixels

Remarks

To convert the value of this property into actual device pixels, you can multiply it by the value of the PixelDensity property.

Methods

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

ToString(IFormatProvider?)

Formats the value of the current instance using the specified format.

public string ToString(IFormatProvider? formatProvider)

Parameters

formatProvider IFormatProvider

The provider to use to format the value.

-or-

A null reference (Nothing in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.

Returns

string

The value of the current instance in the specified format.

ToString(string?)

Formats the value of the current instance using the specified format.

public string ToString(string? format)

Parameters

format string

The format to use.

-or-

A null reference (Nothing in Visual Basic) to use the default format defined for the type of the IFormattable implementation.

Returns

string

The value of the current instance in the specified format.

ToString(string?, IFormatProvider?)

Formats the value of the current instance using the specified format.

public string ToString(string? format, IFormatProvider? formatProvider)

Parameters

format string

The format to use.

-or-

A null reference (Nothing in Visual Basic) to use the default format defined for the type of the IFormattable implementation.

formatProvider IFormatProvider

The provider to use to format the value.

-or-

A null reference (Nothing in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.

Returns

string

The value of the current instance in the specified format.

TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider?)

Tries to format the value of the current instance into the provided span of characters.

public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default, IFormatProvider? provider = null)

Parameters

destination Span<char>

The span in which to write this instance's value formatted as a span of characters.

charsWritten int

When this method returns, contains the number of characters that were written in destination.

format ReadOnlySpan<char>

A span containing the characters that represent a standard or custom format string that defines the acceptable format for destination.

provider IFormatProvider

An optional object that supplies culture-specific formatting information for destination.

Returns

bool

true if the formatting was successful; otherwise, false.