using System; using System.Runtime.InteropServices; using NvAPIWrapper.Native.Attributes; using NvAPIWrapper.Native.Display; using NvAPIWrapper.Native.General.Structures; using NvAPIWrapper.Native.Helpers; using NvAPIWrapper.Native.Interfaces; using NvAPIWrapper.Native.Interfaces.Mosaic; namespace NvAPIWrapper.Native.Mosaic.Structures { /// /// Holds information about a display in a grid topology /// [StructLayout(LayoutKind.Sequential, Pack = 8)] [StructureVersion] public struct GridTopologyDisplayV2 : IGridTopologyDisplay, IInitializable, IEquatable { internal StructureVersion _Version; internal readonly uint _DisplayId; internal readonly int _OverlapX; internal readonly int _OverlapY; internal readonly Rotate _Rotation; internal readonly uint _CloneGroup; internal readonly PixelShiftType _PixelShiftType; /// /// Creates a new GridTopologyDisplayV2 /// /// Display identification /// Horizontal overlap (+overlap, -gap) /// Vertical overlap (+overlap, -gap) /// Rotation of display /// Clone group identification; Reserved, must be 0 /// Type of the pixel shift enabled display // ReSharper disable once TooManyDependencies public GridTopologyDisplayV2( uint displayId, int overlapX, int overlapY, Rotate rotation, uint cloneGroup = 0, PixelShiftType pixelShiftType = PixelShiftType.NoPixelShift) : this() { this = typeof(GridTopologyDisplayV2).Instantiate(); _DisplayId = displayId; _OverlapX = overlapX; _OverlapY = overlapY; _Rotation = rotation; _CloneGroup = cloneGroup; _PixelShiftType = pixelShiftType; } /// public bool Equals(GridTopologyDisplayV2 other) { return _DisplayId == other._DisplayId && _OverlapX == other._OverlapX && _OverlapY == other._OverlapY && _Rotation == other._Rotation && _CloneGroup == other._CloneGroup && _PixelShiftType == other._PixelShiftType; } /// public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) { return false; } return obj is GridTopologyDisplayV2 v2 && Equals(v2); } /// public override int GetHashCode() { unchecked { var hashCode = (int) _DisplayId; hashCode = (hashCode * 397) ^ _OverlapX; hashCode = (hashCode * 397) ^ _OverlapY; hashCode = (hashCode * 397) ^ (int) _Rotation; hashCode = (hashCode * 397) ^ (int) _CloneGroup; hashCode = (hashCode * 397) ^ (int) _PixelShiftType; return hashCode; } } /// /// Checks for equality between two objects of same type /// /// The first object /// The second object /// true, if both objects are equal, otherwise false public static bool operator ==(GridTopologyDisplayV2 left, GridTopologyDisplayV2 right) { return left.Equals(right); } /// /// Checks for inequality between two objects of same type /// /// The first object /// The second object /// true, if both objects are not equal, otherwise false public static bool operator !=(GridTopologyDisplayV2 left, GridTopologyDisplayV2 right) { return !left.Equals(right); } /// public uint DisplayId { get => _DisplayId; } /// public int OverlapX { get => _OverlapX; } /// public int OverlapY { get => _OverlapY; } /// public Rotate Rotation { get => _Rotation; } /// public uint CloneGroup { get => _CloneGroup; } /// public PixelShiftType PixelShiftType { get => _PixelShiftType; } } }