Skip to main content

History: Mogre Colourvalue helper class

Preview of version: 2

This structure has been designed to extend Mogre's native Colourvalue structure. It has static fields for all known colors and convert .Net colors to ogre colours (and vise versa).
Most of the helper class is based on Axiom's colourvalue class.

Add to your project

The helper class is a single code file. There is a VB.Net and a C# version available.

Copy to clipboard
using Microsoft.VisualBasic; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics; #region "LGPL License" // //Axiom Graphics Engine Library //Copyright (C) 2003-2006 Axiom Project Team // //The overall design, and a majority of the core engine and rendering code //contained within this library is a derivative of the open source Object Oriented //Graphics Engine OGRE, which can be found at http://ogre.sourceforge.net. //Many thanks to the OGRE team for maintaining such a high quality project. // //This library is free software; you can redistribute it and/or //modify it under the terms of the GNU Lesser General Public //License as published by the Free Software Foundation; either //version 2.1 of the License, or (at your option) any later version. // //This library is distributed in the hope that it will be useful, //but WITHOUT ANY WARRANTY; without even the implied warranty of //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //Lesser General Public License for more details. // //You should have received a copy of the GNU Lesser General Public //License along with this library; if not, write to the Free Software //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // #endregion #region "SVN Version Information" // <file> // <license see="http://axiomengine.sf.net/wiki/index.php/license.txt"/> // <id value="$Id: colourvalue.cs 1756 2009-09-10 10:15:10Z borrillis $"/> // </file> #endregion #region "Namespace Declarations" using Mogre; #endregion /// <summary> /// This class is necessary so we can store the color components as floating /// point values in the range [0,1]. It serves as an intermediary to System.Drawing.Color, which /// stores them as byte values. This doesn't allow for slow color component /// interpolation, because with the values always being cast back to a byte would lose /// any small interpolated values (i.e. 223 - .25 as a byte is 223). /// </summary> public struct ColorEx : IComparable { #region "Member variables" /// <summary> /// Alpha value [0,1]. /// </summary> public float a; /// <summary> /// Red color component [0,1]. /// </summary> public float r; /// <summary> /// Green color component [0,1]. /// </summary> public float g; /// <summary> /// Blue color component [0,1]. /// </summary> public float b; #endregion #region "Constructors" /// <summary> /// Constructor taking RGB values /// </summary> /// <param name="r">Red color component.</param> /// <param name="g">Green color component.</param> /// <param name="b">Blue color component.</param> public ColorEx(float r, float g, float b) : this(1f, r, g, b) { } /// <summary> /// Create a new colourvalue from a .Net color /// </summary> /// <param name="Color"></param> /// <remarks></remarks> public ColorEx(System.Drawing.Color Color) : this(Color.R, Color.G, Color.B) { } /// <summary> /// Constructor taking all component values. /// </summary> /// <param name="a">Alpha value.</param> /// <param name="r">Red color component.</param> /// <param name="g">Green color component.</param> /// <param name="b">Blue color component.</param> public ColorEx(float a, float r, float g, float b) { //Contract.Requires(a >= 0.0F AndAlso a <= 1.0F) //Contract.Requires(r >= 0.0F AndAlso r <= 1.0F) //Contract.Requires(g >= 0.0F AndAlso g <= 1.0F) //Contract.Requires(b >= 0.0F AndAlso b <= 1.0F) this.a = a; this.r = r; this.g = g; this.b = b; } /// <summary> /// Copy constructor. /// </summary> /// <param name="other">The colourvalue instance to copy</param> public ColorEx(ColourValue other) : this(other.a, other.r, other.g, other.b) { } public ColourValue FromColor(System.Drawing.Color Color) { return new ColourValue(Color.R / 255, Color.G / 255, Color.B / 255); } #endregion #region "Methods" /// <summary> /// Returns a copy of this colourvalue instance. /// </summary> /// <returns></returns> public ColourValue Clone() { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = this.a; retVal.r = this.r; retVal.g = this.g; retVal.b = this.g; return retVal; } /// <summary> /// Converts this instance to a <see cref="System.Drawing.Color"/> structure. /// </summary> public System.Drawing.Color ToColor() { return System.Drawing.Color.FromArgb((a * 255f), (r * 255f), (g * 255f), (b * 255f)); } public int ToRGBA() { int result = 0; result += Convert.ToInt32((r * 255f)) << 24; result += Convert.ToInt32((g * 255f)) << 16; result += Convert.ToInt32((b * 255f)) << 8; result += Convert.ToInt32((a * 255f)); return result; } /// <summary> /// Converts this color value to packed ABGR format. /// </summary> /// <returns></returns> public int ToABGR() { int result = 0; result += Convert.ToInt32((a * 255f)) << 24; result += Convert.ToInt32((b * 255f)) << 16; result += Convert.ToInt32((g * 255f)) << 8; result += Convert.ToInt32((r * 255f)); return result; } /// <summary> /// Converts this color value to packed ARBG format. /// </summary> /// <returns></returns> public int ToARGB() { int result = 0; result += Convert.ToInt32((a * 255f)) << 24; result += Convert.ToInt32((r * 255f)) << 16; result += Convert.ToInt32((g * 255f)) << 8; result += Convert.ToInt32((b * 255f)); return result; } /// <summary> /// Populates the color components in a 4 elements array in RGBA order. /// </summary> /// <remarks> /// Primarily used to help in OpenGL. /// </remarks> public void ToArrayRGBA(float[] vals) { vals[0] = r; vals[1] = g; vals[2] = b; vals[3] = a; } public ColourValue ToColorValue() { return new ColourValue(this.r, this.g, this.b); } #endregion public void AA() { ColourValue MyMogrePurple = new ColourValue(0.5019608f, 0f, 0.5019608f, 1f); Color purple = new ColorEx(MyMogrePurple).ToColor(); } #region "Static color properties" /// <summary> /// The color Transparent. /// </summary> public static ColourValue Transparent { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 0f; retVal.r = 1f; retVal.g = 1f; retVal.b = 1f; return retVal; } } /// <summary> /// The color AliceBlue. /// </summary> public static ColourValue AliceBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9411765f; retVal.g = 0.972549f; retVal.b = 1f; return retVal; } } /// <summary> /// The color AntiqueWhite. /// </summary> public static ColourValue AntiqueWhite { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9803922f; retVal.g = 0.9215686f; retVal.b = 0.8431373f; return retVal; } } /// <summary> /// The color Aqua. /// </summary> public static ColourValue Aqua { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0f; retVal.g = 1f; retVal.b = 1f; return retVal; } } /// <summary> /// The color Aquamarine. /// </summary> public static ColourValue Aquamarine { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.4980392f; retVal.g = 1f; retVal.b = 0.8313726f; return retVal; } } /// <summary> /// The color Azure. /// </summary> public static ColourValue Azure { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9411765f; retVal.g = 1f; retVal.b = 1f; return retVal; } } /// <summary> /// The color Beige. /// </summary> public static ColourValue Beige { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9607843f; retVal.g = 0.9607843f; retVal.b = 0.8627451f; return retVal; } } /// <summary> /// The color Bisque. /// </summary> public static ColourValue Bisque { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.8941177f; retVal.b = 0.7686275f; return retVal; } } /// <summary> /// The color Black. /// </summary> public static ColourValue Black { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0f; retVal.g = 0f; retVal.b = 0f; return retVal; } } /// <summary> /// The color BlanchedAlmond. /// </summary> public static ColourValue BlanchedAlmond { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.9215686f; retVal.b = 0.8039216f; return retVal; } } /// <summary> /// The color Blue. /// </summary> public static ColourValue Blue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0f; retVal.g = 0f; retVal.b = 1f; return retVal; } } /// <summary> /// The color BlueViolet. /// </summary> public static ColourValue BlueViolet { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.5411765f; retVal.g = 0.1686275f; retVal.b = 0.8862745f; return retVal; } } /// <summary> /// The color Brown. /// </summary> public static ColourValue Brown { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.6470588f; retVal.g = 0.1647059f; retVal.b = 0.1647059f; return retVal; } } /// <summary> /// The color BurlyWood. /// </summary> public static ColourValue BurlyWood { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.8705882f; retVal.g = 0.7215686f; retVal.b = 0.5294118f; return retVal; } } /// <summary> /// The color CadetBlue. /// </summary> public static ColourValue CadetBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.372549f; retVal.g = 0.6196079f; retVal.b = 0.627451f; return retVal; } } /// <summary> /// The color Chartreuse. /// </summary> public static ColourValue Chartreuse { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.4980392f; retVal.g = 1f; retVal.b = 0f; return retVal; } } /// <summary> /// The color Chocolate. /// </summary> public static ColourValue Chocolate { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.8235294f; retVal.g = 0.4117647f; retVal.b = 0.1176471f; return retVal; } } /// <summary> /// The color Coral. /// </summary> public static ColourValue Coral { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.4980392f; retVal.b = 0.3137255f; return retVal; } } /// <summary> /// The color CornflowerBlue. /// </summary> public static ColourValue CornflowerBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.3921569f; retVal.g = 0.5843138f; retVal.b = 0.9294118f; return retVal; } } /// <summary> /// The color Cornsilk. /// </summary> public static ColourValue Cornsilk { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.972549f; retVal.b = 0.8627451f; return retVal; } } /// <summary> /// The color Crimson. /// </summary> public static ColourValue Crimson { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.8627451f; retVal.g = 0.07843138f; retVal.b = 0.2352941f; return retVal; } } /// <summary> /// The color Cyan. /// </summary> public static ColourValue Cyan { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0f; retVal.g = 1f; retVal.b = 1f; return retVal; } } /// <summary> /// The color DarkBlue. /// </summary> public static ColourValue DarkBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0f; retVal.g = 0f; retVal.b = 0.5450981f; return retVal; } } /// <summary> /// The color DarkCyan. /// </summary> public static ColourValue DarkCyan { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0f; retVal.g = 0.5450981f; retVal.b = 0.5450981f; return retVal; } } /// <summary> /// The color DarkGoldenrod. /// </summary> public static ColourValue DarkGoldenrod { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.7215686f; retVal.g = 0.5254902f; retVal.b = 0.04313726f; return retVal; } } /// <summary> /// The color DarkGray. /// </summary> public static ColourValue DarkGray { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.6627451f; retVal.g = 0.6627451f; retVal.b = 0.6627451f; return retVal; } } /// <summary> /// The color DarkGreen. /// </summary> public static ColourValue DarkGreen { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0f; retVal.g = 0.3921569f; retVal.b = 0f; return retVal; } } /// <summary> /// The color DarkKhaki. /// </summary> public static ColourValue DarkKhaki { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.7411765f; retVal.g = 0.7176471f; retVal.b = 0.4196078f; return retVal; } } /// <summary> /// The color DarkMagenta. /// </summary> public static ColourValue DarkMagenta { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.5450981f; retVal.g = 0f; retVal.b = 0.5450981f; return retVal; } } /// <summary> /// The color DarkOliveGreen. /// </summary> public static ColourValue DarkOliveGreen { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.3333333f; retVal.g = 0.4196078f; retVal.b = 0.1843137f; return retVal; } } /// <summary> /// The color DarkOrange. /// </summary> public static ColourValue DarkOrange { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.5490196f; retVal.b = 0f; return retVal; } } /// <summary> /// The color DarkOrchid. /// </summary> public static ColourValue DarkOrchid { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.6f; retVal.g = 0.1960784f; retVal.b = 0.8f; return retVal; } } /// <summary> /// The color DarkRed. /// </summary> public static ColourValue DarkRed { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.5450981f; retVal.g = 0f; retVal.b = 0f; return retVal; } } /// <summary> /// The color DarkSalmon. /// </summary> public static ColourValue DarkSalmon { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9137255f; retVal.g = 0.5882353f; retVal.b = 0.4784314f; return retVal; } } /// <summary> /// The color DarkSeaGreen. /// </summary> public static ColourValue DarkSeaGreen { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.5607843f; retVal.g = 0.7372549f; retVal.b = 0.5450981f; return retVal; } } /// <summary> /// The color DarkSlateBlue. /// </summary> public static ColourValue DarkSlateBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.282353f; retVal.g = 0.2392157f; retVal.b = 0.5450981f; return retVal; } } /// <summary> /// The color DarkSlateGray. /// </summary> public static ColourValue DarkSlateGray { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.1843137f; retVal.g = 0.3098039f; retVal.b = 0.3098039f; return retVal; } } /// <summary> /// The color DarkTurquoise. /// </summary> public static ColourValue DarkTurquoise { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0f; retVal.g = 0.8078431f; retVal.b = 0.8196079f; return retVal; } } /// <summary> /// The color DarkViolet. /// </summary> public static ColourValue DarkViolet { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.5803922f; retVal.g = 0f; retVal.b = 0.827451f; return retVal; } } /// <summary> /// The color DeepPink. /// </summary> public static ColourValue DeepPink { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.07843138f; retVal.b = 0.5764706f; return retVal; } } /// <summary> /// The color DeepSkyBlue. /// </summary> public static ColourValue DeepSkyBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0f; retVal.g = 0.7490196f; retVal.b = 1f; return retVal; } } /// <summary> /// The color DimGray. /// </summary> public static ColourValue DimGray { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.4117647f; retVal.g = 0.4117647f; retVal.b = 0.4117647f; return retVal; } } /// <summary> /// The color DodgerBlue. /// </summary> public static ColourValue DodgerBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.1176471f; retVal.g = 0.5647059f; retVal.b = 1f; return retVal; } } /// <summary> /// The color Firebrick. /// </summary> public static ColourValue Firebrick { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.6980392f; retVal.g = 0.1333333f; retVal.b = 0.1333333f; return retVal; } } /// <summary> /// The color FloralWhite. /// </summary> public static ColourValue FloralWhite { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.9803922f; retVal.b = 0.9411765f; return retVal; } } /// <summary> /// The color ForestGreen. /// </summary> public static ColourValue ForestGreen { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.1333333f; retVal.g = 0.5450981f; retVal.b = 0.1333333f; return retVal; } } /// <summary> /// The color Fuchsia. /// </summary> public static ColourValue Fuchsia { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0f; retVal.b = 1f; return retVal; } } /// <summary> /// The color Gainsboro. /// </summary> public static ColourValue Gainsboro { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.8627451f; retVal.g = 0.8627451f; retVal.b = 0.8627451f; return retVal; } } /// <summary> /// The color GhostWhite. /// </summary> public static ColourValue GhostWhite { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.972549f; retVal.g = 0.972549f; retVal.b = 1f; return retVal; } } /// <summary> /// The color Gold. /// </summary> public static ColourValue Gold { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.8431373f; retVal.b = 0f; return retVal; } } /// <summary> /// The color Goldenrod. /// </summary> public static ColourValue Goldenrod { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.854902f; retVal.g = 0.6470588f; retVal.b = 0.1254902f; return retVal; } } /// <summary> /// The color Gray. /// </summary> public static ColourValue Gray { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.5019608f; retVal.g = 0.5019608f; retVal.b = 0.5019608f; return retVal; } } /// <summary> /// The color Green. /// </summary> public static ColourValue Green { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0f; retVal.g = 0.5019608f; retVal.b = 0f; return retVal; } } /// <summary> /// The color GreenYellow. /// </summary> public static ColourValue GreenYellow { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.6784314f; retVal.g = 1f; retVal.b = 0.1843137f; return retVal; } } /// <summary> /// The color Honeydew. /// </summary> public static ColourValue Honeydew { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9411765f; retVal.g = 1f; retVal.b = 0.9411765f; return retVal; } } /// <summary> /// The color HotPink. /// </summary> public static ColourValue HotPink { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.4117647f; retVal.b = 0.7058824f; return retVal; } } /// <summary> /// The color IndianRed. /// </summary> public static ColourValue IndianRed { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.8039216f; retVal.g = 0.3607843f; retVal.b = 0.3607843f; return retVal; } } /// <summary> /// The color Indigo. /// </summary> public static ColourValue Indigo { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.2941177f; retVal.g = 0f; retVal.b = 0.509804f; return retVal; } } /// <summary> /// The color Ivory. /// </summary> public static ColourValue Ivory { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 1f; retVal.b = 0.9411765f; return retVal; } } /// <summary> /// The color Khaki. /// </summary> public static ColourValue Khaki { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9411765f; retVal.g = 0.9019608f; retVal.b = 0.5490196f; return retVal; } } /// <summary> /// The color Lavender. /// </summary> public static ColourValue Lavender { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9019608f; retVal.g = 0.9019608f; retVal.b = 0.9803922f; return retVal; } } /// <summary> /// The color LavenderBlush. /// </summary> public static ColourValue LavenderBlush { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.9411765f; retVal.b = 0.9607843f; return retVal; } } /// <summary> /// The color LawnGreen. /// </summary> public static ColourValue LawnGreen { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.4862745f; retVal.g = 0.9882353f; retVal.b = 0f; return retVal; } } /// <summary> /// The color LemonChiffon. /// </summary> public static ColourValue LemonChiffon { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.9803922f; retVal.b = 0.8039216f; return retVal; } } /// <summary> /// The color LightBlue. /// </summary> public static ColourValue LightBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.6784314f; retVal.g = 0.8470588f; retVal.b = 0.9019608f; return retVal; } } /// <summary> /// The color LightCoral. /// </summary> public static ColourValue LightCoral { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9411765f; retVal.g = 0.5019608f; retVal.b = 0.5019608f; return retVal; } } /// <summary> /// The color LightCyan. /// </summary> public static ColourValue LightCyan { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.8784314f; retVal.g = 1f; retVal.b = 1f; return retVal; } } /// <summary> /// The color LightGoldenrodYellow. /// </summary> public static ColourValue LightGoldenrodYellow { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9803922f; retVal.g = 0.9803922f; retVal.b = 0.8235294f; return retVal; } } /// <summary> /// The color LightGreen. /// </summary> public static ColourValue LightGreen { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.5647059f; retVal.g = 0.9333333f; retVal.b = 0.5647059f; return retVal; } } /// <summary> /// The color LightGray. /// </summary> public static ColourValue LightGray { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.827451f; retVal.g = 0.827451f; retVal.b = 0.827451f; return retVal; } } /// <summary> /// The color LightPink. /// </summary> public static ColourValue LightPink { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.7137255f; retVal.b = 0.7568628f; return retVal; } } /// <summary> /// The color LightSalmon. /// </summary> public static ColourValue LightSalmon { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.627451f; retVal.b = 0.4784314f; return retVal; } } /// <summary> /// The color LightSeaGreen. /// </summary> public static ColourValue LightSeaGreen { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.1254902f; retVal.g = 0.6980392f; retVal.b = 0.6666667f; return retVal; } } /// <summary> /// The color LightSkyBlue. /// </summary> public static ColourValue LightSkyBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.5294118f; retVal.g = 0.8078431f; retVal.b = 0.9803922f; return retVal; } } /// <summary> /// The color LightSlateGray. /// </summary> public static ColourValue LightSlateGray { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.4666667f; retVal.g = 0.5333334f; retVal.b = 0.6f; return retVal; } } /// <summary> /// The color LightSteelBlue. /// </summary> public static ColourValue LightSteelBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.6901961f; retVal.g = 0.7686275f; retVal.b = 0.8705882f; return retVal; } } /// <summary> /// The color LightYellow. /// </summary> public static ColourValue LightYellow { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 1f; retVal.b = 0.8784314f; return retVal; } } /// <summary> /// The color Lime. /// </summary> public static ColourValue Lime { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0f; retVal.g = 1f; retVal.b = 0f; return retVal; } } /// <summary> /// The color LimeGreen. /// </summary> public static ColourValue LimeGreen { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.1960784f; retVal.g = 0.8039216f; retVal.b = 0.1960784f; return retVal; } } /// <summary> /// The color Linen. /// </summary> public static ColourValue Linen { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9803922f; retVal.g = 0.9411765f; retVal.b = 0.9019608f; return retVal; } } /// <summary> /// The color Magenta. /// </summary> public static ColourValue Magenta { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0f; retVal.b = 1f; return retVal; } } /// <summary> /// The color Maroon. /// </summary> public static ColourValue Maroon { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.5019608f; retVal.g = 0f; retVal.b = 0f; return retVal; } } /// <summary> /// The color MediumAquamarine. /// </summary> public static ColourValue MediumAquamarine { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.4f; retVal.g = 0.8039216f; retVal.b = 0.6666667f; return retVal; } } /// <summary> /// The color MediumBlue. /// </summary> public static ColourValue MediumBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0f; retVal.g = 0f; retVal.b = 0.8039216f; return retVal; } } /// <summary> /// The color MediumOrchid. /// </summary> public static ColourValue MediumOrchid { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.7294118f; retVal.g = 0.3333333f; retVal.b = 0.827451f; return retVal; } } /// <summary> /// The color MediumPurple. /// </summary> public static ColourValue MediumPurple { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.5764706f; retVal.g = 0.4392157f; retVal.b = 0.8588235f; return retVal; } } /// <summary> /// The color MediumSeaGreen. /// </summary> public static ColourValue MediumSeaGreen { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.2352941f; retVal.g = 0.7019608f; retVal.b = 0.4431373f; return retVal; } } /// <summary> /// The color MediumSlateBlue. /// </summary> public static ColourValue MediumSlateBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.4823529f; retVal.g = 0.4078431f; retVal.b = 0.9333333f; return retVal; } } /// <summary> /// The color MediumSpringGreen. /// </summary> public static ColourValue MediumSpringGreen { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0f; retVal.g = 0.9803922f; retVal.b = 0.6039216f; return retVal; } } /// <summary> /// The color MediumTurquoise. /// </summary> public static ColourValue MediumTurquoise { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.282353f; retVal.g = 0.8196079f; retVal.b = 0.8f; return retVal; } } /// <summary> /// The color MediumVioletRed. /// </summary> public static ColourValue MediumVioletRed { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.7803922f; retVal.g = 0.08235294f; retVal.b = 0.5215687f; return retVal; } } /// <summary> /// The color MidnightBlue. /// </summary> public static ColourValue MidnightBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.09803922f; retVal.g = 0.09803922f; retVal.b = 0.4392157f; return retVal; } } /// <summary> /// The color MintCream. /// </summary> public static ColourValue MintCream { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9607843f; retVal.g = 1f; retVal.b = 0.9803922f; return retVal; } } /// <summary> /// The color MistyRose. /// </summary> public static ColourValue MistyRose { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.8941177f; retVal.b = 0.8823529f; return retVal; } } /// <summary> /// The color Moccasin. /// </summary> public static ColourValue Moccasin { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.8941177f; retVal.b = 0.7098039f; return retVal; } } /// <summary> /// The color NavajoWhite. /// </summary> public static ColourValue NavajoWhite { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.8705882f; retVal.b = 0.6784314f; return retVal; } } /// <summary> /// The color Navy. /// </summary> public static ColourValue Navy { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0f; retVal.g = 0f; retVal.b = 0.5019608f; return retVal; } } /// <summary> /// The color OldLace. /// </summary> public static ColourValue OldLace { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9921569f; retVal.g = 0.9607843f; retVal.b = 0.9019608f; return retVal; } } /// <summary> /// The color Olive. /// </summary> public static ColourValue Olive { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.5019608f; retVal.g = 0.5019608f; retVal.b = 0f; return retVal; } } /// <summary> /// The color OliveDrab. /// </summary> public static ColourValue OliveDrab { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.4196078f; retVal.g = 0.5568628f; retVal.b = 0.1372549f; return retVal; } } /// <summary> /// The color Orange. /// </summary> public static ColourValue Orange { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.6470588f; retVal.b = 0f; return retVal; } } /// <summary> /// The color OrangeRed. /// </summary> public static ColourValue OrangeRed { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.2705882f; retVal.b = 0f; return retVal; } } /// <summary> /// The color Orchid. /// </summary> public static ColourValue Orchid { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.854902f; retVal.g = 0.4392157f; retVal.b = 0.8392157f; return retVal; } } /// <summary> /// The color PaleGoldenrod. /// </summary> public static ColourValue PaleGoldenrod { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9333333f; retVal.g = 0.9098039f; retVal.b = 0.6666667f; return retVal; } } /// <summary> /// The color PaleGreen. /// </summary> public static ColourValue PaleGreen { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.5960785f; retVal.g = 0.9843137f; retVal.b = 0.5960785f; return retVal; } } /// <summary> /// The color PaleTurquoise. /// </summary> public static ColourValue PaleTurquoise { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.6862745f; retVal.g = 0.9333333f; retVal.b = 0.9333333f; return retVal; } } /// <summary> /// The color PaleVioletRed. /// </summary> public static ColourValue PaleVioletRed { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.8588235f; retVal.g = 0.4392157f; retVal.b = 0.5764706f; return retVal; } } /// <summary> /// The color PapayaWhip. /// </summary> public static ColourValue PapayaWhip { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.9372549f; retVal.b = 0.8352941f; return retVal; } } /// <summary> /// The color PeachPuff. /// </summary> public static ColourValue PeachPuff { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.854902f; retVal.b = 0.7254902f; return retVal; } } /// <summary> /// The color Peru. /// </summary> public static ColourValue Peru { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.8039216f; retVal.g = 0.5215687f; retVal.b = 0.2470588f; return retVal; } } /// <summary> /// The color Pink. /// </summary> public static ColourValue Pink { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.7529412f; retVal.b = 0.7960784f; return retVal; } } /// <summary> /// The color Plum. /// </summary> public static ColourValue Plum { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.8666667f; retVal.g = 0.627451f; retVal.b = 0.8666667f; return retVal; } } /// <summary> /// The color PowderBlue. /// </summary> public static ColourValue PowderBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.6901961f; retVal.g = 0.8784314f; retVal.b = 0.9019608f; return retVal; } } /// <summary> /// The color Purple. /// </summary> public static ColourValue Purple { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.5019608f; retVal.g = 0f; retVal.b = 0.5019608f; return retVal; } } /// <summary> /// The color Red. /// </summary> public static ColourValue Red { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0f; retVal.b = 0f; return retVal; } } /// <summary> /// The color RosyBrown. /// </summary> public static ColourValue RosyBrown { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.7372549f; retVal.g = 0.5607843f; retVal.b = 0.5607843f; return retVal; } } /// <summary> /// The color RoyalBlue. /// </summary> public static ColourValue RoyalBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.254902f; retVal.g = 0.4117647f; retVal.b = 0.8823529f; return retVal; } } /// <summary> /// The color SaddleBrown. /// </summary> public static ColourValue SaddleBrown { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.5450981f; retVal.g = 0.2705882f; retVal.b = 0.07450981f; return retVal; } } /// <summary> /// The color Salmon. /// </summary> public static ColourValue Salmon { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9803922f; retVal.g = 0.5019608f; retVal.b = 0.4470588f; return retVal; } } /// <summary> /// The color SandyBrown. /// </summary> public static ColourValue SandyBrown { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9568627f; retVal.g = 0.6431373f; retVal.b = 0.3764706f; return retVal; } } /// <summary> /// The color SeaGreen. /// </summary> public static ColourValue SeaGreen { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.1803922f; retVal.g = 0.5450981f; retVal.b = 0.3411765f; return retVal; } } /// <summary> /// The color SeaShell. /// </summary> public static ColourValue SeaShell { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.9607843f; retVal.b = 0.9333333f; return retVal; } } /// <summary> /// The color Sienna. /// </summary> public static ColourValue Sienna { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.627451f; retVal.g = 0.3215686f; retVal.b = 0.1764706f; return retVal; } } /// <summary> /// The color Silver. /// </summary> public static ColourValue Silver { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.7529412f; retVal.g = 0.7529412f; retVal.b = 0.7529412f; return retVal; } } /// <summary> /// The color SkyBlue. /// </summary> public static ColourValue SkyBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.5294118f; retVal.g = 0.8078431f; retVal.b = 0.9215686f; return retVal; } } /// <summary> /// The color SlateBlue. /// </summary> public static ColourValue SlateBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.4156863f; retVal.g = 0.3529412f; retVal.b = 0.8039216f; return retVal; } } /// <summary> /// The color SlateGray. /// </summary> public static ColourValue SlateGray { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.4392157f; retVal.g = 0.5019608f; retVal.b = 0.5647059f; return retVal; } } /// <summary> /// The color Snow. /// </summary> public static ColourValue Snow { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.9803922f; retVal.b = 0.9803922f; return retVal; } } /// <summary> /// The color SpringGreen. /// </summary> public static ColourValue SpringGreen { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0f; retVal.g = 1f; retVal.b = 0.4980392f; return retVal; } } /// <summary> /// The color SteelBlue. /// </summary> public static ColourValue SteelBlue { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.2745098f; retVal.g = 0.509804f; retVal.b = 0.7058824f; return retVal; } } /// <summary> /// The color Tan. /// </summary> public static ColourValue Tan { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.8235294f; retVal.g = 0.7058824f; retVal.b = 0.5490196f; return retVal; } } /// <summary> /// The color Teal. /// </summary> public static ColourValue Teal { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0f; retVal.g = 0.5019608f; retVal.b = 0.5019608f; return retVal; } } /// <summary> /// The color Thistle. /// </summary> public static ColourValue Thistle { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.8470588f; retVal.g = 0.7490196f; retVal.b = 0.8470588f; return retVal; } } /// <summary> /// The color Tomato. /// </summary> public static ColourValue Tomato { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 0.3882353f; retVal.b = 0.2784314f; return retVal; } } /// <summary> /// The color Turquoise. /// </summary> public static ColourValue Turquoise { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.2509804f; retVal.g = 0.8784314f; retVal.b = 0.8156863f; return retVal; } } /// <summary> /// The color Violet. /// </summary> public static ColourValue Violet { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9333333f; retVal.g = 0.509804f; retVal.b = 0.9333333f; return retVal; } } /// <summary> /// The color Wheat. /// </summary> public static ColourValue Wheat { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9607843f; retVal.g = 0.8705882f; retVal.b = 0.7019608f; return retVal; } } /// <summary> /// The color White. /// </summary> public static ColourValue White { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 1f; retVal.b = 1f; return retVal; } } /// <summary> /// The color WhiteSmoke. /// </summary> public static ColourValue WhiteSmoke { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.9607843f; retVal.g = 0.9607843f; retVal.b = 0.9607843f; return retVal; } } /// <summary> /// The color Yellow. /// </summary> public static ColourValue Yellow { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 1f; retVal.g = 1f; retVal.b = 0f; return retVal; } } /// <summary> /// The color YellowGreen. /// </summary> public static ColourValue YellowGreen { get { ColourValue retVal = new ColourValue(0, 0, 0, 0); retVal.a = 1f; retVal.r = 0.6039216f; retVal.g = 0.8039216f; retVal.b = 0.1960784f; return retVal; } } //TODO : Move this to StringConverter public static ColourValue Parse_0_255_String(string parsableText) { ColourValue retVal = new ColourValue(0, 0, 0, 0); if (parsableText == null) { throw new ArgumentException("The parsableText parameter cannot be null."); } string[] vals = parsableText.TrimStart('(', '[', '<').TrimEnd(')', ']', '>').Split(','); if (vals.Length < 3) { throw new FormatException(string.Format("Cannot parse the text '{0}' because it must of the form (r,g,b) or (r,g,b,a)", parsableText)); } //float r, g, b, a; try { retVal.r = int.Parse(vals[0].Trim()) / 255f; retVal.g = int.Parse(vals[1].Trim()) / 255f; retVal.b = int.Parse(vals[2].Trim()) / 255f; if (vals.Length == 4) { retVal.a = int.Parse(vals[3].Trim()) / 255f; } else { retVal.a = 1f; } } catch (Exception e) { throw new FormatException("The parts of the colourvalue in Parse_0_255 must be integers"); } return retVal; } //TODO : Move this to StringConverter public string To_0_255_String() { return string.Format("({0},{1},{2},{3})", Convert.ToInt32((r * 255f)), Convert.ToInt32((g * 255f)), Convert.ToInt32((b * 255f)), Convert.ToInt32((a * 255f))); } #endregion #region "Object overloads" /// <summary> /// Override GetHashCode. /// </summary> /// <remarks> /// Done mainly to quash warnings, no real need for it. /// </remarks> /// <returns></returns> public override int GetHashCode() { return this.ToARGB(); } public override string ToString() { return this.To_0_255_String(); } static explicit operator ColorEx(ColourValue ColourValue) { return new ColorEx(ColourValue); } static explicit operator ColourValue(ColorEx ColorEx) { return ColorEx.ToColorValue(); } static explicit operator Color(ColorEx ColorEx) { return ColorEx.ToColor(); } public static Color ToColor(Mogre.ColourValue ColourValue) { return new ColorEx(ColourValue).ToColor(); } public static ColourValue ToColourValue(Color Color) { return new ColorEx(Color).ToColorValue(); } #endregion #region "IComparable Members" /// <summary> /// Used to compare 2 colourvalue objects for equality. /// </summary> /// <param name="obj">An instance of a colourvalue object to compare to this instance.</param> /// <returns>0 if they are equal, 1 if they are not.</returns> public int CompareTo(object obj) { ColourValue other = (ColourValue)obj; if (this.a == other.a && this.r == other.r && this.g == other.g && this.b == other.b) { return 0; } return 1; } #endregion }

-(VB.NET)-

Copy to clipboard
#Region "LGPL License" ' 'Axiom Graphics Engine Library 'Copyright (C) 2003-2006 Axiom Project Team ' 'The overall design, and a majority of the core engine and rendering code 'contained within this library is a derivative of the open source Object Oriented 'Graphics Engine OGRE, which can be found at http://ogre.sourceforge.net. 'Many thanks to the OGRE team for maintaining such a high quality project. ' 'This library is free software; you can redistribute it and/or 'modify it under the terms of the GNU Lesser General Public 'License as published by the Free Software Foundation; either 'version 2.1 of the License, or (at your option) any later version. ' 'This library is distributed in the hope that it will be useful, 'but WITHOUT ANY WARRANTY; without even the implied warranty of 'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 'Lesser General Public License for more details. ' 'You should have received a copy of the GNU Lesser General Public 'License along with this library; if not, write to the Free Software 'Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ' #End Region #Region "SVN Version Information" ' <file> ' <license see="http://axiomengine.sf.net/wiki/index.php/license.txt"/> ' <id value="$Id: colourvalue.cs 1756 2009-09-10 10:15:10Z borrillis $"/> ' </file> #End Region #Region "Namespace Declarations" Imports System Imports Mogre #End Region ''' <summary> ''' This class is necessary so we can store the color components as floating ''' point values in the range [0,1]. It serves as an intermediary to System.Drawing.Color, which ''' stores them as byte values. This doesn't allow for slow color component ''' interpolation, because with the values always being cast back to a byte would lose ''' any small interpolated values (i.e. 223 - .25 as a byte is 223). ''' </summary> Public Structure ColorEx Implements IComparable #Region "Member variables" ''' <summary> ''' Alpha value [0,1]. ''' </summary> Public a As Single ''' <summary> ''' Red color component [0,1]. ''' </summary> Public r As Single ''' <summary> ''' Green color component [0,1]. ''' </summary> Public g As Single ''' <summary> ''' Blue color component [0,1]. ''' </summary> Public b As Single #End Region #Region "Constructors" ''' <summary> ''' Constructor taking RGB values ''' </summary> ''' <param name="r">Red color component.</param> ''' <param name="g">Green color component.</param> ''' <param name="b">Blue color component.</param> Public Sub New(ByVal r As Single, ByVal g As Single, ByVal b As Single) Me.New(1.0F, r, g, b) End Sub ''' <summary> ''' Create a new colourvalue from a .Net color ''' </summary> ''' <param name="Color"></param> ''' <remarks></remarks> Public Sub New(ByVal Color As Drawing.Color) Me.New(Color.R, Color.G, Color.B) End Sub ''' <summary> ''' Constructor taking all component values. ''' </summary> ''' <param name="a">Alpha value.</param> ''' <param name="r">Red color component.</param> ''' <param name="g">Green color component.</param> ''' <param name="b">Blue color component.</param> Public Sub New(ByVal a As Single, ByVal r As Single, ByVal g As Single, ByVal b As Single) 'Contract.Requires(a >= 0.0F AndAlso a <= 1.0F) 'Contract.Requires(r >= 0.0F AndAlso r <= 1.0F) 'Contract.Requires(g >= 0.0F AndAlso g <= 1.0F) 'Contract.Requires(b >= 0.0F AndAlso b <= 1.0F) Me.a = a Me.r = r Me.g = g Me.b = b End Sub ''' <summary> ''' Copy constructor. ''' </summary> ''' <param name="other">The colourvalue instance to copy</param> Public Sub New(ByVal other As ColourValue) Me.New(other.a, other.r, other.g, other.b) End Sub Public Function FromColor(ByVal Color As Drawing.Color) As ColourValue Return New ColourValue(Color.R / 255, Color.G / 255, Color.B / 255) End Function #End Region #Region "Methods" ''' <summary> ''' Returns a copy of this colourvalue instance. ''' </summary> ''' <returns></returns> Public Function Clone() As ColourValue Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = Me.a retVal.r = Me.r retVal.g = Me.g retVal.b = Me.g Return retVal End Function ''' <summary> ''' Converts this instance to a <see cref="System.Drawing.Color"/> structure. ''' </summary> Public Function ToColor() As System.Drawing.Color Return System.Drawing.Color.FromArgb((a * 255.0F), (r * 255.0F), (g * 255.0F), (b * 255.0F)) End Function Public Function ToRGBA() As Integer Dim result As Integer = 0 result += CInt((r * 255.0F)) << 24 result += CInt((g * 255.0F)) << 16 result += CInt((b * 255.0F)) << 8 result += CInt((a * 255.0F)) Return result End Function ''' <summary> ''' Converts this color value to packed ABGR format. ''' </summary> ''' <returns></returns> Public Function ToABGR() As Integer Dim result As Integer = 0 result += CInt((a * 255.0F)) << 24 result += CInt((b * 255.0F)) << 16 result += CInt((g * 255.0F)) << 8 result += CInt((r * 255.0F)) Return result End Function ''' <summary> ''' Converts this color value to packed ARBG format. ''' </summary> ''' <returns></returns> Public Function ToARGB() As Integer Dim result As Integer = 0 result += CInt((a * 255.0F)) << 24 result += CInt((r * 255.0F)) << 16 result += CInt((g * 255.0F)) << 8 result += CInt((b * 255.0F)) Return result End Function ''' <summary> ''' Populates the color components in a 4 elements array in RGBA order. ''' </summary> ''' <remarks> ''' Primarily used to help in OpenGL. ''' </remarks> Public Sub ToArrayRGBA(ByVal vals As Single()) vals(0) = r vals(1) = g vals(2) = b vals(3) = a End Sub Public Function ToColorValue() As ColourValue Return New ColourValue(Me.r, Me.g, Me.b) End Function #End Region Public Sub AA() Dim MyMogrePurple As New ColourValue(0.5019608F, 0.0F, 0.5019608F, 1.0F) Dim purple As Color = New ColorEx(MyMogrePurple).ToColor End Sub #Region "Static color properties" ''' <summary> ''' The color Transparent. ''' </summary> Public Shared ReadOnly Property Transparent() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 0.0F retVal.r = 1.0F retVal.g = 1.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color AliceBlue. ''' </summary> Public Shared ReadOnly Property AliceBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9411765F retVal.g = 0.972549F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color AntiqueWhite. ''' </summary> Public Shared ReadOnly Property AntiqueWhite() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9803922F retVal.g = 0.9215686F retVal.b = 0.8431373F Return retVal End Get End Property ''' <summary> ''' The color Aqua. ''' </summary> Public Shared ReadOnly Property Aqua() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 1.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color Aquamarine. ''' </summary> Public Shared ReadOnly Property Aquamarine() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4980392F retVal.g = 1.0F retVal.b = 0.8313726F Return retVal End Get End Property ''' <summary> ''' The color Azure. ''' </summary> Public Shared ReadOnly Property Azure() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9411765F retVal.g = 1.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color Beige. ''' </summary> Public Shared ReadOnly Property Beige() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9607843F retVal.g = 0.9607843F retVal.b = 0.8627451F Return retVal End Get End Property ''' <summary> ''' The color Bisque. ''' </summary> Public Shared ReadOnly Property Bisque() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.8941177F retVal.b = 0.7686275F Return retVal End Get End Property ''' <summary> ''' The color Black. ''' </summary> Public Shared ReadOnly Property Black() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.0F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color BlanchedAlmond. ''' </summary> Public Shared ReadOnly Property BlanchedAlmond() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.9215686F retVal.b = 0.8039216F Return retVal End Get End Property ''' <summary> ''' The color Blue. ''' </summary> Public Shared ReadOnly Property Blue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color BlueViolet. ''' </summary> Public Shared ReadOnly Property BlueViolet() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5411765F retVal.g = 0.1686275F retVal.b = 0.8862745F Return retVal End Get End Property ''' <summary> ''' The color Brown. ''' </summary> Public Shared ReadOnly Property Brown() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6470588F retVal.g = 0.1647059F retVal.b = 0.1647059F Return retVal End Get End Property ''' <summary> ''' The color BurlyWood. ''' </summary> Public Shared ReadOnly Property BurlyWood() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8705882F retVal.g = 0.7215686F retVal.b = 0.5294118F Return retVal End Get End Property ''' <summary> ''' The color CadetBlue. ''' </summary> Public Shared ReadOnly Property CadetBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.372549F retVal.g = 0.6196079F retVal.b = 0.627451F Return retVal End Get End Property ''' <summary> ''' The color Chartreuse. ''' </summary> Public Shared ReadOnly Property Chartreuse() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4980392F retVal.g = 1.0F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color Chocolate. ''' </summary> Public Shared ReadOnly Property Chocolate() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8235294F retVal.g = 0.4117647F retVal.b = 0.1176471F Return retVal End Get End Property ''' <summary> ''' The color Coral. ''' </summary> Public Shared ReadOnly Property Coral() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.4980392F retVal.b = 0.3137255F Return retVal End Get End Property ''' <summary> ''' The color CornflowerBlue. ''' </summary> Public Shared ReadOnly Property CornflowerBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.3921569F retVal.g = 0.5843138F retVal.b = 0.9294118F Return retVal End Get End Property ''' <summary> ''' The color Cornsilk. ''' </summary> Public Shared ReadOnly Property Cornsilk() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.972549F retVal.b = 0.8627451F Return retVal End Get End Property ''' <summary> ''' The color Crimson. ''' </summary> Public Shared ReadOnly Property Crimson() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8627451F retVal.g = 0.07843138F retVal.b = 0.2352941F Return retVal End Get End Property ''' <summary> ''' The color Cyan. ''' </summary> Public Shared ReadOnly Property Cyan() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 1.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color DarkBlue. ''' </summary> Public Shared ReadOnly Property DarkBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.0F retVal.b = 0.5450981F Return retVal End Get End Property ''' <summary> ''' The color DarkCyan. ''' </summary> Public Shared ReadOnly Property DarkCyan() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.5450981F retVal.b = 0.5450981F Return retVal End Get End Property ''' <summary> ''' The color DarkGoldenrod. ''' </summary> Public Shared ReadOnly Property DarkGoldenrod() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.7215686F retVal.g = 0.5254902F retVal.b = 0.04313726F Return retVal End Get End Property ''' <summary> ''' The color DarkGray. ''' </summary> Public Shared ReadOnly Property DarkGray() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6627451F retVal.g = 0.6627451F retVal.b = 0.6627451F Return retVal End Get End Property ''' <summary> ''' The color DarkGreen. ''' </summary> Public Shared ReadOnly Property DarkGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.3921569F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color DarkKhaki. ''' </summary> Public Shared ReadOnly Property DarkKhaki() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.7411765F retVal.g = 0.7176471F retVal.b = 0.4196078F Return retVal End Get End Property ''' <summary> ''' The color DarkMagenta. ''' </summary> Public Shared ReadOnly Property DarkMagenta() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5450981F retVal.g = 0.0F retVal.b = 0.5450981F Return retVal End Get End Property ''' <summary> ''' The color DarkOliveGreen. ''' </summary> Public Shared ReadOnly Property DarkOliveGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.3333333F retVal.g = 0.4196078F retVal.b = 0.1843137F Return retVal End Get End Property ''' <summary> ''' The color DarkOrange. ''' </summary> Public Shared ReadOnly Property DarkOrange() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.5490196F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color DarkOrchid. ''' </summary> Public Shared ReadOnly Property DarkOrchid() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6F retVal.g = 0.1960784F retVal.b = 0.8F Return retVal End Get End Property ''' <summary> ''' The color DarkRed. ''' </summary> Public Shared ReadOnly Property DarkRed() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5450981F retVal.g = 0.0F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color DarkSalmon. ''' </summary> Public Shared ReadOnly Property DarkSalmon() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9137255F retVal.g = 0.5882353F retVal.b = 0.4784314F Return retVal End Get End Property ''' <summary> ''' The color DarkSeaGreen. ''' </summary> Public Shared ReadOnly Property DarkSeaGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5607843F retVal.g = 0.7372549F retVal.b = 0.5450981F Return retVal End Get End Property ''' <summary> ''' The color DarkSlateBlue. ''' </summary> Public Shared ReadOnly Property DarkSlateBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.282353F retVal.g = 0.2392157F retVal.b = 0.5450981F Return retVal End Get End Property ''' <summary> ''' The color DarkSlateGray. ''' </summary> Public Shared ReadOnly Property DarkSlateGray() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.1843137F retVal.g = 0.3098039F retVal.b = 0.3098039F Return retVal End Get End Property ''' <summary> ''' The color DarkTurquoise. ''' </summary> Public Shared ReadOnly Property DarkTurquoise() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.8078431F retVal.b = 0.8196079F Return retVal End Get End Property ''' <summary> ''' The color DarkViolet. ''' </summary> Public Shared ReadOnly Property DarkViolet() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5803922F retVal.g = 0.0F retVal.b = 0.827451F Return retVal End Get End Property ''' <summary> ''' The color DeepPink. ''' </summary> Public Shared ReadOnly Property DeepPink() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.07843138F retVal.b = 0.5764706F Return retVal End Get End Property ''' <summary> ''' The color DeepSkyBlue. ''' </summary> Public Shared ReadOnly Property DeepSkyBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.7490196F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color DimGray. ''' </summary> Public Shared ReadOnly Property DimGray() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4117647F retVal.g = 0.4117647F retVal.b = 0.4117647F Return retVal End Get End Property ''' <summary> ''' The color DodgerBlue. ''' </summary> Public Shared ReadOnly Property DodgerBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.1176471F retVal.g = 0.5647059F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color Firebrick. ''' </summary> Public Shared ReadOnly Property Firebrick() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6980392F retVal.g = 0.1333333F retVal.b = 0.1333333F Return retVal End Get End Property ''' <summary> ''' The color FloralWhite. ''' </summary> Public Shared ReadOnly Property FloralWhite() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.9803922F retVal.b = 0.9411765F Return retVal End Get End Property ''' <summary> ''' The color ForestGreen. ''' </summary> Public Shared ReadOnly Property ForestGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.1333333F retVal.g = 0.5450981F retVal.b = 0.1333333F Return retVal End Get End Property ''' <summary> ''' The color Fuchsia. ''' </summary> Public Shared ReadOnly Property Fuchsia() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color Gainsboro. ''' </summary> Public Shared ReadOnly Property Gainsboro() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8627451F retVal.g = 0.8627451F retVal.b = 0.8627451F Return retVal End Get End Property ''' <summary> ''' The color GhostWhite. ''' </summary> Public Shared ReadOnly Property GhostWhite() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.972549F retVal.g = 0.972549F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color Gold. ''' </summary> Public Shared ReadOnly Property Gold() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.8431373F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color Goldenrod. ''' </summary> Public Shared ReadOnly Property Goldenrod() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.854902F retVal.g = 0.6470588F retVal.b = 0.1254902F Return retVal End Get End Property ''' <summary> ''' The color Gray. ''' </summary> Public Shared ReadOnly Property Gray() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5019608F retVal.g = 0.5019608F retVal.b = 0.5019608F Return retVal End Get End Property ''' <summary> ''' The color Green. ''' </summary> Public Shared ReadOnly Property Green() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.5019608F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color GreenYellow. ''' </summary> Public Shared ReadOnly Property GreenYellow() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6784314F retVal.g = 1.0F retVal.b = 0.1843137F Return retVal End Get End Property ''' <summary> ''' The color Honeydew. ''' </summary> Public Shared ReadOnly Property Honeydew() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9411765F retVal.g = 1.0F retVal.b = 0.9411765F Return retVal End Get End Property ''' <summary> ''' The color HotPink. ''' </summary> Public Shared ReadOnly Property HotPink() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.4117647F retVal.b = 0.7058824F Return retVal End Get End Property ''' <summary> ''' The color IndianRed. ''' </summary> Public Shared ReadOnly Property IndianRed() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8039216F retVal.g = 0.3607843F retVal.b = 0.3607843F Return retVal End Get End Property ''' <summary> ''' The color Indigo. ''' </summary> Public Shared ReadOnly Property Indigo() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.2941177F retVal.g = 0.0F retVal.b = 0.509804F Return retVal End Get End Property ''' <summary> ''' The color Ivory. ''' </summary> Public Shared ReadOnly Property Ivory() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 1.0F retVal.b = 0.9411765F Return retVal End Get End Property ''' <summary> ''' The color Khaki. ''' </summary> Public Shared ReadOnly Property Khaki() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9411765F retVal.g = 0.9019608F retVal.b = 0.5490196F Return retVal End Get End Property ''' <summary> ''' The color Lavender. ''' </summary> Public Shared ReadOnly Property Lavender() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9019608F retVal.g = 0.9019608F retVal.b = 0.9803922F Return retVal End Get End Property ''' <summary> ''' The color LavenderBlush. ''' </summary> Public Shared ReadOnly Property LavenderBlush() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.9411765F retVal.b = 0.9607843F Return retVal End Get End Property ''' <summary> ''' The color LawnGreen. ''' </summary> Public Shared ReadOnly Property LawnGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4862745F retVal.g = 0.9882353F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color LemonChiffon. ''' </summary> Public Shared ReadOnly Property LemonChiffon() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.9803922F retVal.b = 0.8039216F Return retVal End Get End Property ''' <summary> ''' The color LightBlue. ''' </summary> Public Shared ReadOnly Property LightBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6784314F retVal.g = 0.8470588F retVal.b = 0.9019608F Return retVal End Get End Property ''' <summary> ''' The color LightCoral. ''' </summary> Public Shared ReadOnly Property LightCoral() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9411765F retVal.g = 0.5019608F retVal.b = 0.5019608F Return retVal End Get End Property ''' <summary> ''' The color LightCyan. ''' </summary> Public Shared ReadOnly Property LightCyan() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8784314F retVal.g = 1.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color LightGoldenrodYellow. ''' </summary> Public Shared ReadOnly Property LightGoldenrodYellow() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9803922F retVal.g = 0.9803922F retVal.b = 0.8235294F Return retVal End Get End Property ''' <summary> ''' The color LightGreen. ''' </summary> Public Shared ReadOnly Property LightGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5647059F retVal.g = 0.9333333F retVal.b = 0.5647059F Return retVal End Get End Property ''' <summary> ''' The color LightGray. ''' </summary> Public Shared ReadOnly Property LightGray() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.827451F retVal.g = 0.827451F retVal.b = 0.827451F Return retVal End Get End Property ''' <summary> ''' The color LightPink. ''' </summary> Public Shared ReadOnly Property LightPink() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.7137255F retVal.b = 0.7568628F Return retVal End Get End Property ''' <summary> ''' The color LightSalmon. ''' </summary> Public Shared ReadOnly Property LightSalmon() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.627451F retVal.b = 0.4784314F Return retVal End Get End Property ''' <summary> ''' The color LightSeaGreen. ''' </summary> Public Shared ReadOnly Property LightSeaGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.1254902F retVal.g = 0.6980392F retVal.b = 0.6666667F Return retVal End Get End Property ''' <summary> ''' The color LightSkyBlue. ''' </summary> Public Shared ReadOnly Property LightSkyBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5294118F retVal.g = 0.8078431F retVal.b = 0.9803922F Return retVal End Get End Property ''' <summary> ''' The color LightSlateGray. ''' </summary> Public Shared ReadOnly Property LightSlateGray() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4666667F retVal.g = 0.5333334F retVal.b = 0.6F Return retVal End Get End Property ''' <summary> ''' The color LightSteelBlue. ''' </summary> Public Shared ReadOnly Property LightSteelBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6901961F retVal.g = 0.7686275F retVal.b = 0.8705882F Return retVal End Get End Property ''' <summary> ''' The color LightYellow. ''' </summary> Public Shared ReadOnly Property LightYellow() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 1.0F retVal.b = 0.8784314F Return retVal End Get End Property ''' <summary> ''' The color Lime. ''' </summary> Public Shared ReadOnly Property Lime() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 1.0F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color LimeGreen. ''' </summary> Public Shared ReadOnly Property LimeGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.1960784F retVal.g = 0.8039216F retVal.b = 0.1960784F Return retVal End Get End Property ''' <summary> ''' The color Linen. ''' </summary> Public Shared ReadOnly Property Linen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9803922F retVal.g = 0.9411765F retVal.b = 0.9019608F Return retVal End Get End Property ''' <summary> ''' The color Magenta. ''' </summary> Public Shared ReadOnly Property Magenta() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color Maroon. ''' </summary> Public Shared ReadOnly Property Maroon() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5019608F retVal.g = 0.0F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color MediumAquamarine. ''' </summary> Public Shared ReadOnly Property MediumAquamarine() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4F retVal.g = 0.8039216F retVal.b = 0.6666667F Return retVal End Get End Property ''' <summary> ''' The color MediumBlue. ''' </summary> Public Shared ReadOnly Property MediumBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.0F retVal.b = 0.8039216F Return retVal End Get End Property ''' <summary> ''' The color MediumOrchid. ''' </summary> Public Shared ReadOnly Property MediumOrchid() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.7294118F retVal.g = 0.3333333F retVal.b = 0.827451F Return retVal End Get End Property ''' <summary> ''' The color MediumPurple. ''' </summary> Public Shared ReadOnly Property MediumPurple() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5764706F retVal.g = 0.4392157F retVal.b = 0.8588235F Return retVal End Get End Property ''' <summary> ''' The color MediumSeaGreen. ''' </summary> Public Shared ReadOnly Property MediumSeaGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.2352941F retVal.g = 0.7019608F retVal.b = 0.4431373F Return retVal End Get End Property ''' <summary> ''' The color MediumSlateBlue. ''' </summary> Public Shared ReadOnly Property MediumSlateBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4823529F retVal.g = 0.4078431F retVal.b = 0.9333333F Return retVal End Get End Property ''' <summary> ''' The color MediumSpringGreen. ''' </summary> Public Shared ReadOnly Property MediumSpringGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.9803922F retVal.b = 0.6039216F Return retVal End Get End Property ''' <summary> ''' The color MediumTurquoise. ''' </summary> Public Shared ReadOnly Property MediumTurquoise() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.282353F retVal.g = 0.8196079F retVal.b = 0.8F Return retVal End Get End Property ''' <summary> ''' The color MediumVioletRed. ''' </summary> Public Shared ReadOnly Property MediumVioletRed() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.7803922F retVal.g = 0.08235294F retVal.b = 0.5215687F Return retVal End Get End Property ''' <summary> ''' The color MidnightBlue. ''' </summary> Public Shared ReadOnly Property MidnightBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.09803922F retVal.g = 0.09803922F retVal.b = 0.4392157F Return retVal End Get End Property ''' <summary> ''' The color MintCream. ''' </summary> Public Shared ReadOnly Property MintCream() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9607843F retVal.g = 1.0F retVal.b = 0.9803922F Return retVal End Get End Property ''' <summary> ''' The color MistyRose. ''' </summary> Public Shared ReadOnly Property MistyRose() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.8941177F retVal.b = 0.8823529F Return retVal End Get End Property ''' <summary> ''' The color Moccasin. ''' </summary> Public Shared ReadOnly Property Moccasin() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.8941177F retVal.b = 0.7098039F Return retVal End Get End Property ''' <summary> ''' The color NavajoWhite. ''' </summary> Public Shared ReadOnly Property NavajoWhite() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.8705882F retVal.b = 0.6784314F Return retVal End Get End Property ''' <summary> ''' The color Navy. ''' </summary> Public Shared ReadOnly Property Navy() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.0F retVal.b = 0.5019608F Return retVal End Get End Property ''' <summary> ''' The color OldLace. ''' </summary> Public Shared ReadOnly Property OldLace() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9921569F retVal.g = 0.9607843F retVal.b = 0.9019608F Return retVal End Get End Property ''' <summary> ''' The color Olive. ''' </summary> Public Shared ReadOnly Property Olive() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5019608F retVal.g = 0.5019608F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color OliveDrab. ''' </summary> Public Shared ReadOnly Property OliveDrab() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4196078F retVal.g = 0.5568628F retVal.b = 0.1372549F Return retVal End Get End Property ''' <summary> ''' The color Orange. ''' </summary> Public Shared ReadOnly Property Orange() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.6470588F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color OrangeRed. ''' </summary> Public Shared ReadOnly Property OrangeRed() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.2705882F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color Orchid. ''' </summary> Public Shared ReadOnly Property Orchid() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.854902F retVal.g = 0.4392157F retVal.b = 0.8392157F Return retVal End Get End Property ''' <summary> ''' The color PaleGoldenrod. ''' </summary> Public Shared ReadOnly Property PaleGoldenrod() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9333333F retVal.g = 0.9098039F retVal.b = 0.6666667F Return retVal End Get End Property ''' <summary> ''' The color PaleGreen. ''' </summary> Public Shared ReadOnly Property PaleGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5960785F retVal.g = 0.9843137F retVal.b = 0.5960785F Return retVal End Get End Property ''' <summary> ''' The color PaleTurquoise. ''' </summary> Public Shared ReadOnly Property PaleTurquoise() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6862745F retVal.g = 0.9333333F retVal.b = 0.9333333F Return retVal End Get End Property ''' <summary> ''' The color PaleVioletRed. ''' </summary> Public Shared ReadOnly Property PaleVioletRed() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8588235F retVal.g = 0.4392157F retVal.b = 0.5764706F Return retVal End Get End Property ''' <summary> ''' The color PapayaWhip. ''' </summary> Public Shared ReadOnly Property PapayaWhip() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.9372549F retVal.b = 0.8352941F Return retVal End Get End Property ''' <summary> ''' The color PeachPuff. ''' </summary> Public Shared ReadOnly Property PeachPuff() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.854902F retVal.b = 0.7254902F Return retVal End Get End Property ''' <summary> ''' The color Peru. ''' </summary> Public Shared ReadOnly Property Peru() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8039216F retVal.g = 0.5215687F retVal.b = 0.2470588F Return retVal End Get End Property ''' <summary> ''' The color Pink. ''' </summary> Public Shared ReadOnly Property Pink() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.7529412F retVal.b = 0.7960784F Return retVal End Get End Property ''' <summary> ''' The color Plum. ''' </summary> Public Shared ReadOnly Property Plum() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8666667F retVal.g = 0.627451F retVal.b = 0.8666667F Return retVal End Get End Property ''' <summary> ''' The color PowderBlue. ''' </summary> Public Shared ReadOnly Property PowderBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6901961F retVal.g = 0.8784314F retVal.b = 0.9019608F Return retVal End Get End Property ''' <summary> ''' The color Purple. ''' </summary> Public Shared ReadOnly Property Purple() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5019608F retVal.g = 0.0F retVal.b = 0.5019608F Return retVal End Get End Property ''' <summary> ''' The color Red. ''' </summary> Public Shared ReadOnly Property Red() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.0F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color RosyBrown. ''' </summary> Public Shared ReadOnly Property RosyBrown() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.7372549F retVal.g = 0.5607843F retVal.b = 0.5607843F Return retVal End Get End Property ''' <summary> ''' The color RoyalBlue. ''' </summary> Public Shared ReadOnly Property RoyalBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.254902F retVal.g = 0.4117647F retVal.b = 0.8823529F Return retVal End Get End Property ''' <summary> ''' The color SaddleBrown. ''' </summary> Public Shared ReadOnly Property SaddleBrown() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5450981F retVal.g = 0.2705882F retVal.b = 0.07450981F Return retVal End Get End Property ''' <summary> ''' The color Salmon. ''' </summary> Public Shared ReadOnly Property Salmon() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9803922F retVal.g = 0.5019608F retVal.b = 0.4470588F Return retVal End Get End Property ''' <summary> ''' The color SandyBrown. ''' </summary> Public Shared ReadOnly Property SandyBrown() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9568627F retVal.g = 0.6431373F retVal.b = 0.3764706F Return retVal End Get End Property ''' <summary> ''' The color SeaGreen. ''' </summary> Public Shared ReadOnly Property SeaGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.1803922F retVal.g = 0.5450981F retVal.b = 0.3411765F Return retVal End Get End Property ''' <summary> ''' The color SeaShell. ''' </summary> Public Shared ReadOnly Property SeaShell() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.9607843F retVal.b = 0.9333333F Return retVal End Get End Property ''' <summary> ''' The color Sienna. ''' </summary> Public Shared ReadOnly Property Sienna() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.627451F retVal.g = 0.3215686F retVal.b = 0.1764706F Return retVal End Get End Property ''' <summary> ''' The color Silver. ''' </summary> Public Shared ReadOnly Property Silver() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.7529412F retVal.g = 0.7529412F retVal.b = 0.7529412F Return retVal End Get End Property ''' <summary> ''' The color SkyBlue. ''' </summary> Public Shared ReadOnly Property SkyBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5294118F retVal.g = 0.8078431F retVal.b = 0.9215686F Return retVal End Get End Property ''' <summary> ''' The color SlateBlue. ''' </summary> Public Shared ReadOnly Property SlateBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4156863F retVal.g = 0.3529412F retVal.b = 0.8039216F Return retVal End Get End Property ''' <summary> ''' The color SlateGray. ''' </summary> Public Shared ReadOnly Property SlateGray() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4392157F retVal.g = 0.5019608F retVal.b = 0.5647059F Return retVal End Get End Property ''' <summary> ''' The color Snow. ''' </summary> Public Shared ReadOnly Property Snow() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.9803922F retVal.b = 0.9803922F Return retVal End Get End Property ''' <summary> ''' The color SpringGreen. ''' </summary> Public Shared ReadOnly Property SpringGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 1.0F retVal.b = 0.4980392F Return retVal End Get End Property ''' <summary> ''' The color SteelBlue. ''' </summary> Public Shared ReadOnly Property SteelBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.2745098F retVal.g = 0.509804F retVal.b = 0.7058824F Return retVal End Get End Property ''' <summary> ''' The color Tan. ''' </summary> Public Shared ReadOnly Property Tan() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8235294F retVal.g = 0.7058824F retVal.b = 0.5490196F Return retVal End Get End Property ''' <summary> ''' The color Teal. ''' </summary> Public Shared ReadOnly Property Teal() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.5019608F retVal.b = 0.5019608F Return retVal End Get End Property ''' <summary> ''' The color Thistle. ''' </summary> Public Shared ReadOnly Property Thistle() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8470588F retVal.g = 0.7490196F retVal.b = 0.8470588F Return retVal End Get End Property ''' <summary> ''' The color Tomato. ''' </summary> Public Shared ReadOnly Property Tomato() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.3882353F retVal.b = 0.2784314F Return retVal End Get End Property ''' <summary> ''' The color Turquoise. ''' </summary> Public Shared ReadOnly Property Turquoise() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.2509804F retVal.g = 0.8784314F retVal.b = 0.8156863F Return retVal End Get End Property ''' <summary> ''' The color Violet. ''' </summary> Public Shared ReadOnly Property Violet() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9333333F retVal.g = 0.509804F retVal.b = 0.9333333F Return retVal End Get End Property ''' <summary> ''' The color Wheat. ''' </summary> Public Shared ReadOnly Property Wheat() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9607843F retVal.g = 0.8705882F retVal.b = 0.7019608F Return retVal End Get End Property ''' <summary> ''' The color White. ''' </summary> Public Shared ReadOnly Property White() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 1.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color WhiteSmoke. ''' </summary> Public Shared ReadOnly Property WhiteSmoke() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9607843F retVal.g = 0.9607843F retVal.b = 0.9607843F Return retVal End Get End Property ''' <summary> ''' The color Yellow. ''' </summary> Public Shared ReadOnly Property Yellow() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 1.0F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color YellowGreen. ''' </summary> Public Shared ReadOnly Property YellowGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6039216F retVal.g = 0.8039216F retVal.b = 0.1960784F Return retVal End Get End Property 'TODO : Move this to StringConverter Public Shared Function Parse_0_255_String(ByVal parsableText As String) As ColourValue Dim retVal As New ColourValue(0, 0, 0, 0) If parsableText Is Nothing Then Throw New ArgumentException("The parsableText parameter cannot be null.") End If Dim vals As String() = parsableText.TrimStart("("c, "["c, "<"c).TrimEnd(")"c, "]"c, ">"c).Split(","c) If vals.Length < 3 Then Throw New FormatException(String.Format("Cannot parse the text '{0}' because it must of the form (r,g,b) or (r,g,b,a)", parsableText)) End If 'float r, g, b, a; Try retVal.r = Integer.Parse(vals(0).Trim()) / 255.0F retVal.g = Integer.Parse(vals(1).Trim()) / 255.0F retVal.b = Integer.Parse(vals(2).Trim()) / 255.0F If vals.Length = 4 Then retVal.a = Integer.Parse(vals(3).Trim()) / 255.0F Else retVal.a = 1.0F End If Catch e As Exception Throw New FormatException("The parts of the colourvalue in Parse_0_255 must be integers") End Try Return retVal End Function 'TODO : Move this to StringConverter Public Function To_0_255_String() As String Return String.Format("({0},{1},{2},{3})", CInt((r * 255.0F)), CInt((g * 255.0F)), CInt((b * 255.0F)), CInt((a * 255.0F))) End Function #End Region #Region "Object overloads" ''' <summary> ''' Override GetHashCode. ''' </summary> ''' <remarks> ''' Done mainly to quash warnings, no real need for it. ''' </remarks> ''' <returns></returns> Public Overloads Overrides Function GetHashCode() As Integer Return Me.ToARGB() End Function Public Overloads Overrides Function ToString() As String Return Me.To_0_255_String() End Function Overloads Shared Narrowing Operator CType(ByVal ColourValue As ColourValue) As ColorEx Return New ColorEx(ColourValue) End Operator Overloads Shared Narrowing Operator CType(ByVal ColorEx As ColorEx) As ColourValue Return ColorEx.ToColorValue End Operator Overloads Shared Narrowing Operator CType(ByVal ColorEx As ColorEx) As Color Return ColorEx.ToColor End Operator Public Shared Function ToColor(ByVal ColourValue As Mogre.ColourValue) As Color Return New ColorEx(ColourValue).ToColor End Function Public Shared Function ToColourValue(ByVal Color As Color) As ColourValue Return New ColorEx(Color).ToColorValue End Function #End Region #Region "IComparable Members" ''' <summary> ''' Used to compare 2 colourvalue objects for equality. ''' </summary> ''' <param name="obj">An instance of a colourvalue object to compare to this instance.</param> ''' <returns>0 if they are equal, 1 if they are not.</returns> Public Function CompareTo(ByVal obj As Object) As Integer Implements IComparable.CompareTo Dim other As ColourValue = DirectCast(obj, ColourValue) If Me.a = other.a AndAlso Me.r = other.r AndAlso Me.g = other.g AndAlso Me.b = other.b Then Return 0 End If Return 1 End Function #End Region End structure

Example usage

Get Colourvalue

Copy to clipboard
//Use ColorEx's shared fields to get our color: Mogre.ColourValue color = ColorEx.Purple; //Or use the constructor: Mogre.ColourValue color = new ColorEx(System.Drawing.Color.Purple); //Or use the constructor and call ToColourValue: Mogre.ColourValue color = new ColorEx(System.Drawing.Color.Purple).ToColourValue; }

-(VB.NET)-

Copy to clipboard
'Use ColorEx's shared fields to get our color: Dim color As Mogre.ColourValue = ColorEx.Purple 'Or use the constructor: Dim color As Mogre.ColourValue = New ColorEx(Drawing.Color.Purple) 'Or use the constructor and call ToColourValue: Dim color As Mogre.ColourValue = New ColorEx(Drawing.Color.Purple).ToColourValue
Info Information
The helper class is converted to mogrecolour automatically (see above) and vice versa.

Convert a Colourvalue to .Net Color

Copy to clipboard
// Mogre colourvalue (yes, that's the RGBA code for purple) ColourValue MyMogrePurple = new ColourValue(0.5019608f, 0f, 0.5019608f, 1f); // Now we convert this to Drawing.Color: Color purple = new ColorEx(MyMogrePurple).ToColor; // or shorter (but the same): Color purple = new ColorEx(MyMogrePurple);

-(VB.NET)-

Copy to clipboard
' Mogre colourvalue (yes, that's the RGBA code for purple) Dim MyMogrePurple As New ColourValue(0.5019608F, 0.0F, 0.5019608F, 1.0F) ' Now we convert this to Drawing.Color: Dim purple As Color = New ColorEx(MyMogrePurple).ToColor ' or shorter (but the same): Dim purple As Color = New ColorEx(MyMogrePurple)
Info Information
There are static methods, too, but they do exactly thte same thing 😉
  • ColorEx.ToColor
  • ColorEx.ToColourValue

History

Information Version
Sat 17 of Mar, 2012 16:03 GMT-0000 Tubulii 3
Sat 17 of Mar, 2012 16:00 GMT-0000 Tubulii 2
Sat 17 of Mar, 2012 15:59 GMT-0000 Tubulii 1