Table of Contents

Class MonitorHelpers

Namespace
Whim
Assembly
Whim.dll
Helper methods for converting between the coordinate systems.
public static class MonitorHelpers
Inheritance
MonitorHelpers
Inherited Members

Methods

NormalizeAbsolutePoint(IRectangle<int>, IPoint<int>, bool)

Converts the point from the system's coordinate system to the unit square, where the unit square is the monitor's working area, accounting for the origin of the monitor. This is good for converting absolute positions.
public static IPoint<double> NormalizeAbsolutePoint(this IRectangle<int> monitor, IPoint<int> point, bool respectSign = false)

Parameters

monitor IRectangle<int>
point IPoint<int>
The point to translate, in the system's coordinate system.
respectSign bool
Whether to respect the sign. For example, values in [-infinity, 0] will become [-1, 0].

Returns

IPoint<double>
The converted point, where x and y are in the range [0, 1].

NormalizeDeltaPoint(IRectangle<int>, IPoint<int>)

Converts the point from the system's coordinate system to the unit square, where the unit square is the monitor's working area, ignoring the origin of the monitor. This is good for converting deltas.
public static IPoint<double> NormalizeDeltaPoint(this IRectangle<int> monitor, IPoint<int> point)

Parameters

monitor IRectangle<int>
point IPoint<int>

Returns

IPoint<double>

NormalizeRectangle(IRectangle<int>, IRectangle<int>)

Converts the rectangle from the unit square to the monitor's coordinate system. The rectangle is clamped to the monitor's bounds.
public static IRectangle<double> NormalizeRectangle(this IRectangle<int> monitor, IRectangle<int> rectangle)

Parameters

monitor IRectangle<int>
rectangle IRectangle<int>
The point to translate.

Returns

IRectangle<double>
The converted point, where x and y are in the range [0, 1].

ToMonitor(IRectangle<int>, IRectangle<double>)

Converts the rectangle from the unit square to the monitor's coordinate system.
public static IRectangle<int> ToMonitor(this IRectangle<int> monitor, IRectangle<double> rectangle)

Parameters

monitor IRectangle<int>
rectangle IRectangle<double>
The rectangle to translate.

Returns

IRectangle<int>
The converted rectangle.