using NvAPIWrapper.Native; using NvAPIWrapper.Native.Display.Structures; using NvAPIWrapper.Native.GPU; namespace NvAPIWrapper.Display { /// /// This class contains and provides a way to modify the HUE angle /// public class HUEInformation { private readonly DisplayHandle _displayHandle = DisplayHandle.DefaultHandle; private readonly OutputId _outputId = OutputId.Invalid; /// /// Creates a new instance of the class using a DisplayHandle /// /// The handle of the display. public HUEInformation(DisplayHandle displayHandle) { _displayHandle = displayHandle; } /// /// Creates a new instance of this class using a OutputId /// /// The output identification of a display or an output public HUEInformation(OutputId outputId) { _outputId = outputId; } /// /// Gets or sets the current HUE offset angle [0-359] /// public int CurrentAngle { get { PrivateDisplayHUEInfo? hueInfo = null; if (_displayHandle != DisplayHandle.DefaultHandle) { hueInfo = DisplayApi.GetHUEInfo(_displayHandle); } else if (_outputId != OutputId.Invalid) { hueInfo = DisplayApi.GetHUEInfo(_outputId); } return hueInfo?.CurrentAngle ?? 0; } set { value %= 360; if (_displayHandle != DisplayHandle.DefaultHandle) { DisplayApi.SetHUEAngle(_displayHandle, value); } else if (_outputId != OutputId.Invalid) { DisplayApi.SetHUEAngle(_outputId, value); } } } /// /// Gets the default HUE offset angle [0-359] /// public int DefaultAngle { get { PrivateDisplayHUEInfo? hueInfo = null; if (_displayHandle != DisplayHandle.DefaultHandle) { hueInfo = DisplayApi.GetHUEInfo(_displayHandle); } else if (_outputId != OutputId.Invalid) { hueInfo = DisplayApi.GetHUEInfo(_outputId); } return hueInfo?.DefaultAngle ?? 0; } } /// public override string ToString() { return $"{CurrentAngle:D}º [{DefaultAngle:D}º]"; } } }