using System; using System.Runtime.InteropServices; namespace SFML { namespace Graphics { //////////////////////////////////////////////////////////// /// /// Utility class for manipulating 32-bits RGBA colors /// //////////////////////////////////////////////////////////// [StructLayout(LayoutKind.Sequential)] public struct Color { //////////////////////////////////////////////////////////// /// /// Construct the color from its red, green and blue components /// /// Red component /// Green component /// Blue component //////////////////////////////////////////////////////////// public Color(byte red, byte green, byte blue) : this(red, green, blue, 255) { } //////////////////////////////////////////////////////////// /// /// Construct the color from its red, green, blue and alpha components /// /// Red component /// Green component /// Blue component /// Alpha (transparency) component //////////////////////////////////////////////////////////// public Color(byte red, byte green, byte blue, byte alpha) { R = red; G = green; B = blue; A = alpha; } //////////////////////////////////////////////////////////// /// /// Construct the color from another /// /// Color to copy //////////////////////////////////////////////////////////// public Color(Color color) : this(color.R, color.G, color.B, color.A) { } /// Red component of the color public byte R; /// Green component of the color public byte G; /// Blue component of the color public byte B; /// Alpha (transparent) component of the color public byte A; /// Predefined black color public static readonly Color Black = new Color(0, 0, 0); /// Predefined white color public static readonly Color White = new Color(255, 255, 255); /// Predefined red color public static readonly Color Red = new Color(255, 0, 0); /// Predefined green color public static readonly Color Green = new Color(0, 255, 0); /// Predefined blue color public static readonly Color Blue = new Color(0, 0, 255); /// Predefined yellow color public static readonly Color Yellow = new Color(255, 255, 0); /// Predefined magenta color public static readonly Color Magenta = new Color(255, 0, 255); /// Predefined cyan color public static readonly Color Cyan = new Color(0, 255, 255); } } }