Otter  0.9.88
2d Game Development Framework based on SFML.Net
 All Classes Namespaces Functions Variables Enumerations Properties
Otter.Color Class Reference

Class that represents a color with red, green, blue, and alpha channels. More...

Public Member Functions

 Color (float r=1f, float g=1f, float b=1f, float a=1f)
 Create a new color. More...
 
 Color (Color copy)
 Create a color by copying the RGBA from another color. More...
 
 Color (XmlElement e)
 Create a new color from an XML element. More...
 
Color Copy ()
 Return a new color containing the channels from this color. More...
 
 Color (string hex)
 Create a new color from a string. Formats are "RGB", "RGBA", "RRGGBB", and "RRGGBBAA". More...
 
 Color (UInt32 hex)
 Create a new color from a hex number. Formats are 0xRGB, 0xRRGGBB, 0xRGBA, 0xRRGGBBAA. More...
 
override string ToString ()
 
void SetColor (float r, float g, float b, float a)
 
void SetColor (float r, float g, float b)
 
void SetColor (Color color)
 

Static Public Member Functions

static Color Mix (params Color[] colors)
 Return a new color made by mixing multiple colors. Mixes the colors evenly. More...
 
static Color FromHSV (float h, float s, float v, float a)
 Create a new color from HSV values. More...
 
static void AddCustom (Color color, Enum name)
 Store a custom Color. Actually stores a new copy of that Color. More...
 
static void AddCustom (string color, Enum name)
 Store a custom Color. Actually stores a new copy of that Color. More...
 
static void AddCustom (UInt32 color, Enum name)
 Store a custom Color. Actually stores a new copy of that Color. More...
 
static void AddCustom (Color color, string name)
 Store a custom Color. Actually stores a new copy of that Color. More...
 
static void AddCustom (string color, string name)
 Store a custom Color. Actually stores a new copy of that Color. More...
 
static void AddCustom (UInt32 color, string name)
 Store a custom Color. Actually stores a new copy of that Color. More...
 
static Color Custom (Enum name)
 Get a stored custom Color. Returns a new copy of it. More...
 
static Color Custom (string name)
 
static Color Shade (float rgb)
 Create a shade of gray based on a value 0 to 1. More...
 
static Color Shade (float rgb, float a)
 Create a shade of gray based on a value 0 to 1. More...
 
static Color FromBytes (byte r, byte g, byte b, byte a=255)
 Create a Color using byte values 0 - 255. More...
 
static Color operator* (Color value1, Color value2)
 
static Color operator* (Color value1, float value2)
 
static Color operator+ (Color value1, Color value2)
 
static Color operator- (Color value1, Color value2)
 
static Color operator/ (Color value1, Color value2)
 

Properties

static Color White [get]
 
static Color Black [get]
 
static Color Red [get]
 
static Color Green [get]
 
static Color Blue [get]
 
static Color Cyan [get]
 
static Color Magenta [get]
 
static Color Yellow [get]
 
static Color Orange [get]
 
static Color Gold [get]
 
static Color None [get]
 
static Color Grey [get]
 
static Color Gray [get]
 
static Color Random [get]
 
static Color RandomAlpha [get]
 
float R [get, set]
 Red More...
 
float G [get, set]
 Green More...
 
float B [get, set]
 Blue More...
 
float A [get, set]
 Alpha More...
 
byte ByteR [get, set]
 The bytes for Red. More...
 
byte ByteG [get, set]
 The bytes for Green. More...
 
byte ByteB [get, set]
 The bytes for Blue. More...
 
byte ByteA [get, set]
 The bytes for Alpha. More...
 
string ColorString [get]
 Get a hex string of the Color. More...
 

Detailed Description

Class that represents a color with red, green, blue, and alpha channels.

Constructor & Destructor Documentation

Otter.Color.Color ( float  r = 1f,
float  g = 1f,
float  b = 1f,
float  a = 1f 
)

Create a new color.

Parameters
rRed, 0 to 1.
gGreen, 0 to 1.
bBlue, 0 to 1.
aAlpha, 0 to 1.
Otter.Color.Color ( Color  copy)

Create a color by copying the RGBA from another color.

Parameters
copyThe color to copy.
Otter.Color.Color ( XmlElement  e)

Create a new color from an XML element.

Parameters
eAn XmlElement that contains attributes R, G, B, and A, from 0 to 255.
Otter.Color.Color ( string  hex)

Create a new color from a string. Formats are "RGB", "RGBA", "RRGGBB", and "RRGGBBAA".

Parameters
hexA string with a hex representation of each channel.
Otter.Color.Color ( UInt32  hex)

Create a new color from a hex number. Formats are 0xRGB, 0xRRGGBB, 0xRGBA, 0xRRGGBBAA.

Parameters
hexA hex number representing a color.

Member Function Documentation

static void Otter.Color.AddCustom ( Color  color,
Enum  name 
)
static

Store a custom Color. Actually stores a new copy of that Color.

Parameters
colorThe Color to store.
nameThe name of the Color.
static void Otter.Color.AddCustom ( string  color,
Enum  name 
)
static

Store a custom Color. Actually stores a new copy of that Color.

Parameters
colorThe Color to store.
nameThe name of the Color.
static void Otter.Color.AddCustom ( UInt32  color,
Enum  name 
)
static

Store a custom Color. Actually stores a new copy of that Color.

Parameters
colorThe Color to store.
nameThe name of the Color.
static void Otter.Color.AddCustom ( Color  color,
string  name 
)
static

Store a custom Color. Actually stores a new copy of that Color.

Parameters
colorThe Color to store.
nameThe name of the Color.
static void Otter.Color.AddCustom ( string  color,
string  name 
)
static

Store a custom Color. Actually stores a new copy of that Color.

Parameters
colorThe Color to store.
nameThe name of the Color.
static void Otter.Color.AddCustom ( UInt32  color,
string  name 
)
static

Store a custom Color. Actually stores a new copy of that Color.

Parameters
colorThe Color to store.
nameThe name of the Color.
Color Otter.Color.Copy ( )

Return a new color containing the channels from this color.

Returns
static Color Otter.Color.Custom ( Enum  name)
static

Get a stored custom Color. Returns a new copy of it.

Parameters
nameThe name of the Color stored.
Returns
A new copy of the custom Color.
static Color Otter.Color.FromBytes ( byte  r,
byte  g,
byte  b,
byte  a = 255 
)
static

Create a Color using byte values 0 - 255.

Parameters
rRed
gGreen
bBlue
aAlpha
Returns
A new Color.
static Color Otter.Color.FromHSV ( float  h,
float  s,
float  v,
float  a 
)
static

Create a new color from HSV values.

Parameters
hHue, 0 to 360.
sSaturation, 0 to 1.
vValue, 0 to 1.
aAlpha, 0 to 1.
Returns
A new RGBA color.
static Color Otter.Color.Mix ( params Color[]  colors)
static

Return a new color made by mixing multiple colors. Mixes the colors evenly.

Parameters
colorsThe colors to be mixed.
Returns
A new color of all the colors mixed together.
static Color Otter.Color.Shade ( float  rgb)
static

Create a shade of gray based on a value 0 to 1.

Parameters
rgbThe level of gray. 0 is black, 1 is white.
Returns
A color of RGB equal to the value input for rgb.
static Color Otter.Color.Shade ( float  rgb,
float  a 
)
static

Create a shade of gray based on a value 0 to 1.

Parameters
rgbThe level of gray. 0 is black, 1 is white.
aThe alpha of the returned Color.
Returns
A color of RGB equal to the value input for rgb with alpha a.

Property Documentation

float Otter.Color.A
getset

Alpha

float Otter.Color.B
getset

Blue

byte Otter.Color.ByteA
getset

The bytes for Alpha.

byte Otter.Color.ByteB
getset

The bytes for Blue.

byte Otter.Color.ByteG
getset

The bytes for Green.

byte Otter.Color.ByteR
getset

The bytes for Red.

string Otter.Color.ColorString
get

Get a hex string of the Color.

float Otter.Color.G
getset

Green

float Otter.Color.R
getset

Red


The documentation for this class was generated from the following file: