Added the trunk/branches/tags directories at repository root, and moved previous root into trunk/
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1002 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
commit
2f524481c1
974 changed files with 295448 additions and 0 deletions
95
dotnet/src/Graphics/Color.cs
Normal file
95
dotnet/src/Graphics/Color.cs
Normal file
|
@ -0,0 +1,95 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace SFML
|
||||
{
|
||||
namespace Graphics
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Utility class for manipulating 32-bits RGBA colors
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Color
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the color from its red, green and blue components
|
||||
/// </summary>
|
||||
/// <param name="red">Red component</param>
|
||||
/// <param name="green">Green component</param>
|
||||
/// <param name="blue">Blue component</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public Color(byte red, byte green, byte blue) :
|
||||
this(red, green, blue, 255)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the color from its red, green, blue and alpha components
|
||||
/// </summary>
|
||||
/// <param name="red">Red component</param>
|
||||
/// <param name="green">Green component</param>
|
||||
/// <param name="blue">Blue component</param>
|
||||
/// <param name="alpha">Alpha (transparency) component</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public Color(byte red, byte green, byte blue, byte alpha)
|
||||
{
|
||||
R = red;
|
||||
G = green;
|
||||
B = blue;
|
||||
A = alpha;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the color from another
|
||||
/// </summary>
|
||||
/// <param name="color">Color to copy</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public Color(Color color) :
|
||||
this(color.R, color.G, color.B, color.A)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Red component of the color</summary>
|
||||
public byte R;
|
||||
|
||||
/// <summary>Green component of the color</summary>
|
||||
public byte G;
|
||||
|
||||
/// <summary>Blue component of the color</summary>
|
||||
public byte B;
|
||||
|
||||
/// <summary>Alpha (transparent) component of the color</summary>
|
||||
public byte A;
|
||||
|
||||
|
||||
/// <summary>Predefined black color</summary>
|
||||
public static readonly Color Black = new Color(0, 0, 0);
|
||||
|
||||
/// <summary>Predefined white color</summary>
|
||||
public static readonly Color White = new Color(255, 255, 255);
|
||||
|
||||
/// <summary>Predefined red color</summary>
|
||||
public static readonly Color Red = new Color(255, 0, 0);
|
||||
|
||||
/// <summary>Predefined green color</summary>
|
||||
public static readonly Color Green = new Color(0, 255, 0);
|
||||
|
||||
/// <summary>Predefined blue color</summary>
|
||||
public static readonly Color Blue = new Color(0, 0, 255);
|
||||
|
||||
/// <summary>Predefined yellow color</summary>
|
||||
public static readonly Color Yellow = new Color(255, 255, 0);
|
||||
|
||||
/// <summary>Predefined magenta color</summary>
|
||||
public static readonly Color Magenta = new Color(255, 0, 255);
|
||||
|
||||
/// <summary>Predefined cyan color</summary>
|
||||
public static readonly Color Cyan = new Color(0, 255, 255);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue