diff --git a/PInvoke/Gdi32/WinGdi.BITMAPINFO.cs b/PInvoke/Gdi32/WinGdi.BITMAPINFO.cs index 0508dff1..a47102da 100644 --- a/PInvoke/Gdi32/WinGdi.BITMAPINFO.cs +++ b/PInvoke/Gdi32/WinGdi.BITMAPINFO.cs @@ -1231,46 +1231,6 @@ namespace Vanara.PInvoke public static readonly DIBSECTION Default = new() { dsBmih = BITMAPINFOHEADER.Default }; } - /// The RGBQUAD structure describes a color consisting of relative intensities of red, green, and blue. - [StructLayout(LayoutKind.Sequential)] - [PInvokeData("Wingdi.h", MSDNShortId = "dd162938")] - public struct RGBQUAD - { - /// The intensity of blue in the color. - public byte rgbBlue; - - /// The intensity of green in the color. - public byte rgbGreen; - - /// The intensity of red in the color. - public byte rgbRed; - - /// This member is reserved and must be zero. - public byte rgbReserved; - - /// Gets a value indicating whether any transparency is defined. - /// if this value is transparent; otherwise, . - public bool IsTransparent => rgbReserved == 0; - - /// Gets or sets the color associated with the structure. - /// The color. - public COLORREF Color - { - get => new(rgbRed, rgbGreen, rgbBlue) { A = rgbReserved }; - set { rgbReserved = value.A; rgbBlue = value.B; rgbGreen = value.G; rgbRed = value.R; } - } - - /// Performs an implicit conversion from to . - /// The c. - /// The result of the conversion. - public static implicit operator RGBQUAD(COLORREF c) => new() { Color = c }; - - /// Performs an implicit conversion from to . - /// The c. - /// The result of the conversion. - public static implicit operator COLORREF(RGBQUAD c) => c.Color; - } - /// Provides a safe handle to a structure. public class SafeBITMAPINFO : SafeCoTaskMemStruct { diff --git a/PInvoke/Shared/WinGdi/WinGdi.RGBQUAD.cs b/PInvoke/Shared/WinGdi/WinGdi.RGBQUAD.cs new file mode 100644 index 00000000..dcef56d2 --- /dev/null +++ b/PInvoke/Shared/WinGdi/WinGdi.RGBQUAD.cs @@ -0,0 +1,54 @@ +using System.Runtime.InteropServices; + +namespace Vanara.PInvoke +{ + /// The RGBQUAD structure describes a color consisting of relative intensities of red, green, and blue. + [StructLayout(LayoutKind.Sequential)] + [PInvokeData("Wingdi.h", MSDNShortId = "dd162938")] + public struct RGBQUAD + { + /// The intensity of blue in the color. + public byte rgbBlue; + + /// The intensity of green in the color. + public byte rgbGreen; + + /// The intensity of red in the color. + public byte rgbRed; + + /// This member is reserved and must be zero. + public byte rgbReserved; + + /// Gets a value indicating whether any transparency is defined. + /// if this value is transparent; otherwise, . + public bool IsTransparent => rgbReserved == 0; + + /// Gets or sets the color associated with the structure. + /// The color. + public COLORREF Color + { + get => new(rgbRed, rgbGreen, rgbBlue) { A = rgbReserved }; + set { rgbReserved = value.A; rgbBlue = value.B; rgbGreen = value.G; rgbRed = value.R; } + } + + /// Performs an implicit conversion from to . + /// The c. + /// The result of the conversion. + public static implicit operator RGBQUAD(COLORREF c) => new() { Color = c }; + + /// Performs an implicit conversion from to . + /// The c. + /// The result of the conversion. + public static implicit operator COLORREF(RGBQUAD c) => c.Color; + + /// Performs an implicit conversion from to . + /// The c. + /// The result of the conversion. + public static implicit operator RGBQUAD(System.Drawing.Color c) => new() { Color = c }; + + /// Performs an implicit conversion from to . + /// The c. + /// The result of the conversion. + public static implicit operator System.Drawing.Color(RGBQUAD c) => c.Color; + } +} \ No newline at end of file