using System.Windows; using System.Windows.Media; namespace Vanara.PInvoke; /// Conversion extension methods for WinUI/UWP and Vanara types. public static class SystemWindowsExtensions { /// Converts to . /// The color to convert. /// The converted value. public static Color ToColor(this in COLORREF c) => new() { A = c.A, R = c.R, G = c.G, B = c.B }; /// Converts to . /// The color to convert. /// The converted value. public static COLORREF ToCOLORREF(this in Color c) => new(c.R, c.G, c.B) { A = c.A }; /// Converts to . /// The point to convert. /// The converted value. public static Point ToPoint(this in POINT pt) => new(pt.X, pt.Y); /// Converts to . /// The rectangle to convert. /// The converted value. public static Int32Rect ToRect(this in RECT r) => new(r.X, r.Y, r.Width, r.Height); /// Converts to . /// The rectangle to convert. /// The converted value. public static RECT ToRECT(this in Int32Rect r) => new(r.X, r.Y, r.X + r.Width, r.Y + r.Height); /// Converts to . /// The size to convert. /// The converted value. public static Size ToSize(this in SIZE sz) => new(sz.cx, sz.cy); }