using System.Runtime.InteropServices; using NvAPIWrapper.Native.Attributes; using NvAPIWrapper.Native.General.Structures; using NvAPIWrapper.Native.Helpers; using NvAPIWrapper.Native.Interfaces; namespace NvAPIWrapper.Native.Display.Structures { /// /// Hold information about a custom display resolution /// [StructLayout(LayoutKind.Sequential, Pack = 8)] [StructureVersion(1)] public struct CustomDisplay : IInitializable { internal StructureVersion _Version; internal uint _Width; internal uint _Height; internal uint _Depth; internal ColorFormat _ColorFormat; internal ViewPortF _SourcePartition; internal float _XRatio; internal float _YRatio; internal Timing _Timing; internal uint _Flags; /// /// Gets the source surface (source mode) width. /// public uint Width { get => _Width; } /// /// Gets the source surface (source mode) height. /// public uint Height { get => _Height; } /// /// Gets the source surface color depth. "0" means all 8/16/32bpp. /// public uint Depth { get => _Depth; } /// /// Gets the color format (optional) /// public ColorFormat ColorFormat { get => _ColorFormat; } /// /// Gets the source partition viewport. All values are between [0, 1]. For multi-mon support, should be set to /// (0,0,1.0,1.0) for now. /// public ViewPortF SourcePartition { get => _SourcePartition; } /// /// Gets the horizontal scaling ratio. /// public float XRatio { get => _XRatio; } /// /// Gets the vertical scaling ratio. /// public float YRatio { get => _YRatio; } /// /// Gets the timing used to program TMDS/DAC/LVDS/HDMI/TVEncoder, etc. /// public Timing Timing { get => _Timing; } /// /// Gets a boolean value indicating that a hardware mode-set without OS update should be performed. /// public bool HardwareModeSetOnly { get => _Flags.GetBit(0); } /// /// Creates an instance of /// /// The source surface (source mode) width. /// The source surface (source mode) height. /// The source surface color depth. "0" means all 8/16/32bpp. /// The color format (optional) /// The horizontal scaling ratio. /// The vertical scaling ratio. /// The timing used to program TMDS/DAC/LVDS/HDMI/TVEncoder, etc. /// A boolean value indicating that a hardware mode-set without OS update should be performed. public CustomDisplay( uint width, uint height, uint depth, ColorFormat colorFormat, float xRatio, float yRatio, Timing timing, bool hwModeSetOnly ) { this = typeof(CustomDisplay).Instantiate(); _Width = width; _Height = height; _Depth = depth; _ColorFormat = colorFormat; _SourcePartition = new ViewPortF(0, 0, 1, 1); _XRatio = xRatio; _YRatio = yRatio; _Timing = timing; _Flags = _Flags.SetBit(0, hwModeSetOnly); } } }