using System.Drawing; using System.Runtime.InteropServices; namespace NvAPIWrapper.Native.Display.Structures { /// /// Hold information about the screen view port rectangle /// [StructLayout(LayoutKind.Sequential, Pack = 8)] public struct ViewPortF { internal float _X; internal float _Y; internal float _Width; internal float _Height; /// /// Gets the x-coordinate of the viewport top-left point /// public float X { get => _X; } /// /// Gets the y-coordinate of the viewport top-left point /// public float Y { get => _Y; } /// /// Gets the width of the viewport. /// public float Width { get => _Width; } /// /// Gets the height of the viewport. /// public float Height { get => _Height; } /// /// Creates an instance of ViewPortF /// /// The x-coordinate of the viewport top-left point /// The y-coordinate of the viewport top-left point /// The width of the viewport. /// The height of the viewport. public ViewPortF(float x, float y, float width, float height) { _X = x; _Y = y; _Width = width; _Height = height; } /// /// Creates an instance of /// /// The rectangle to take view port information from. public ViewPortF(RectangleF rect) : this(rect.X, rect.Y, rect.Width, rect.Height) { } /// /// Return an instance of representing this view port. /// /// public RectangleF ToRectangle() { return new RectangleF(X, Y, Width, Height); } /// public override string ToString() { return $"({Width:F1}, {Height:F1}) @ ({X:F1}, {Y:F1})"; } } }