Table of Contents

Class DisplayScaleTracker

Namespace
Icy.Rendering.Display
Assembly
IcyUI.dll

Tracks the display scale of a native window by polling an IDisplayScaleProvider.

public sealed class DisplayScaleTracker
Inheritance
DisplayScaleTracker
Inherited Members
Extension Methods

Remarks

Engine integrations create one per render context and call Poll() once per update. Polling is a single cheap OS call and avoids competing with the engine for its window event queue.

Constructors

DisplayScaleTracker(IDisplayScaleProvider, Func<NativeWindowInfo>)

Initializes a new instance of the DisplayScaleTracker class.

public DisplayScaleTracker(IDisplayScaleProvider provider, Func<NativeWindowInfo> windowSource)

Parameters

provider IDisplayScaleProvider

The provider used to read the scale, typically GetProvider().

windowSource Func<NativeWindowInfo>

A callback returning the current native window info. It must not throw.

Properties

Scale

Gets the display scale read by the last Poll() call; 1.0 before the first poll.

public float Scale { get; }

Property Value

float

Methods

Poll()

Reads the current display scale and raises Changed if it differs from Scale.

public bool Poll()

Returns

bool

true if the scale changed; otherwise false.

Remarks

Values that aren't finite and greater than zero are treated as 1.0.

Events

Changed

Occurs when Scale changes during a Poll() call.

public event EventHandler? Changed

Event Type

EventHandler