Table of Contents

Class GeoColor

Namespace
ThinkGeo.Core
Assembly
ThinkGeo.Core.dll

This structure represents a color for drawing on a GeoCanvas.

public class GeoColor
Inheritance
GeoColor
Inherited Members

Constructors

GeoColor()

Initializes a new instance of the GeoColor class.

public GeoColor()

GeoColor(byte, byte, byte)

This constructor creates a new color.

public GeoColor(byte red, byte green, byte blue)

Parameters

red byte

This parameter specifies the red component of the color.

green byte

This parameter specifies the green component of the color.

blue byte

This parameter specifies the blue component of the color.

Remarks

None

Exceptions

ArgumentOutOfRangeException

If you pass in a red value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException

If you pass in a green value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException

If you pass in a blue value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

GeoColor(byte, byte, byte, byte)

This constructor creates a new color.

public GeoColor(byte alpha, byte red, byte green, byte blue)

Parameters

alpha byte

This parameter specifies the alpha, or transparent, component of the color.

red byte

This parameter specifies the red component of the color.

green byte

This parameter specifies the green component of the color.

blue byte

This parameter specifies the blue component of the color.

Remarks

None

Exceptions

ArgumentOutOfRangeException

If you pass in a red value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException

If you pass in a blue value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException

If you pass in a green value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException

If you pass in a alpha value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

GeoColor(byte, GeoColor)

This constructor creates a new color.

public GeoColor(byte alpha, GeoColor color)

Parameters

alpha byte

This parameter specifies the alpha component. An alpha of 0 is totally transparent.

color GeoColor

This parameter specifies the base color.

Remarks

You can use this overload to create a transparent version of another color.

Properties

A

This property returns the alpha component of the GeoColor.

public byte A { get; set; }

Property Value

byte

Remarks

None

Ahsl

Gets or sets the ahsl.

public string Ahsl { get; set; }

Property Value

string

The ahsl.

AlphaComponent

This property returns the alpha component of the GeoColor.

[Obsolete("This property is obsoleted, it will be removed after v13.4, please use A instead. ")]
public byte AlphaComponent { get; set; }

Property Value

byte

Remarks

None

Argb

Gets or sets the ARGB.

public string Argb { get; set; }

Property Value

string

The ARGB.

B

This property returns the blue component of the GeoColor.

public byte B { get; set; }

Property Value

byte

Remarks

None

BlueComponent

This property returns the blue component of the GeoColor.

[Obsolete("This property is obsoleted, it will be removed after v13.4, please use B instead. ")]
public byte BlueComponent { get; set; }

Property Value

byte

Remarks

None

G

This property returns the green component of the GeoColor.

public byte G { get; set; }

Property Value

byte

Remarks

None

GreenComponent

This property returns the green component of the GeoColor.

[Obsolete("This property is obsoleted, it will be removed after v13.4, please use G instead. ")]
public byte GreenComponent { get; set; }

Property Value

byte

Remarks

None

HtmlColor

Gets or sets the color of the HTML.

public string HtmlColor { get; set; }

Property Value

string

The color of the HTML.

Hue

This property returns the hue component of the GeoColor.

public float Hue { get; }

Property Value

float

Remarks

None

IsTransparent

Verify if the GeoColor is transparent, it is considered to be transparent if the Alpha Value is 0.

public bool IsTransparent { get; }

Property Value

bool

Luminance

This property returns the luminance component of the GeoColor.

public float Luminance { get; }

Property Value

float

Remarks

None

R

This property returns the red component of the GeoColor.

public byte R { get; set; }

Property Value

byte

Remarks

None

RedComponent

This property returns the red component of the GeoColor.

[Obsolete("This property is obsoleted, it will be removed after v13.4, please use R instead. ")]
public byte RedComponent { get; set; }

Property Value

byte

Remarks

None

Saturation

This property returns the saturation component of the GeoColor.

public float Saturation { get; }

Property Value

float

Remarks

None

Methods

Equals(object)

This method is an override of the Equals functionality.

public override bool Equals(object obj)

Parameters

obj object

This parameter is the object you want to check to see if it is equal to the current instance.

Returns

bool

This method returns the Equals functionality.

Remarks

None

Exceptions

ArgumentNullException

If you pass a null as the obj, we will throw an ArgumentNullException.

FromAhsl(int, float, float, float)

This parameter specifies the red component of the color. This method returns a GeoColor based on the Alpha, Hue, Saturation, and Luminosity components.

public static GeoColor FromAhsl(int alpha, float hue, float saturation, float luminance)

Parameters

alpha int

This parameter specifies the alpha, or transparent, component of the color.

hue float

This parameter specifies the hue component of the color.

saturation float

This parameter specifies the saturation component of the color.

luminance float

This parameter specifies the luminance component of the color.

Returns

GeoColor

Remarks

None

Exceptions

ArgumentOutOfRangeException

If you pass in a alpha value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException

If you pass in a hue value which is not between 0 and 360, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException

If you pass in a saturation value which is not between 0 and 1, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException

If you pass in a luminance value which is not between 0 and 1, it will throw a ArgumentOutOfRangeException.

FromArgb(byte, byte, byte, byte)

This method returns a GeoColor based on the Alpha, Red, Green, and Blue components.

public static GeoColor FromArgb(byte alpha, byte red, byte green, byte blue)

Parameters

alpha byte

This parameter specifies the alpha, or transparent, component of the color.

red byte

This parameter specifies the red component of the color.

green byte

This parameter specifies the green component of the color.

blue byte

This parameter specifies the blue component of the color.

Returns

GeoColor

This method returns a GeoColor based on the Alpha, Red, Green, and Blue components.

Remarks

None

Exceptions

ArgumentOutOfRangeException

If you pass in a alpha value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException

If you pass in a red value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException

If you pass in a green value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException

If you pass in a blue value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

FromArgb(byte, GeoColor)

This method returns a GeoColor based on the Alpha, Red, Green, and Blue components.

public static GeoColor FromArgb(byte alpha, GeoColor baseColor)

Parameters

alpha byte

This parameter determines how transparent the color is. An alpha of 0 means it is totally transparent.

baseColor GeoColor

This parameter is the color you want to apply the transparency to.

Returns

GeoColor

You can use this overload to create a transparent version of another color.

FromHtml(string)

This method returns a GeoColor from an HTML color (either in hexadecimal or a named color).

public static GeoColor FromHtml(string htmlColor)

Parameters

htmlColor string

This parameter represents the HTML color that you want to convert.

Returns

GeoColor

This method returns a GeoColor from an HTML color (either in hexadecimal or a named color).

Remarks

None

Exceptions

ArgumentOutOfRangeException

If you pass in a htmlColor value which is not valid, it will throw a ArgumentOutOfRangeException.

FromOle(int)

This method returns a GeoColor from an OLE color.

public static GeoColor FromOle(int oleColor)

Parameters

oleColor int

This parameter represents the OLE color you want to convert.

Returns

GeoColor

This method returns a GeoColor from an OLE color.

Remarks

None

FromWin32(int)

This method returns a GeoColor from a Win32 color.

public static GeoColor FromWin32(int win32Color)

Parameters

win32Color int

This parameter represents the Win32 color you want to convert.

Returns

GeoColor

This method returns a GeoColor from a Win32 color.

Remarks

None

GetColorsInHueFamily(GeoColor, int)

This method returns a collection of GeoColors based on the same hue that is passed in.

public static Collection<GeoColor> GetColorsInHueFamily(GeoColor baseColor, int numbersOfColors)

Parameters

baseColor GeoColor

This parameter is the color on which you want to base the color collection.

numbersOfColors int

This parameter represents the number of colors you want returned from the method.

Returns

Collection<GeoColor>

This method returns a collection of GeoColors based on the same hue that is passed in.

Remarks

This method is useful when you want to get a number of colors that have the same hue. For example, you can use this in maps that represent class breaks. If you passed in a red hue, then the method would return variations such as light red, dark red, pastel red, etc.

Exceptions

ArgumentOutOfRangeException

If you pass in a numberOfColors value that is not between 1 and 255, it will throw a ArgumentOutOfRangeException.

GetColorsInQualityFamily(GeoColor, int)

This method returns a collection of GeoColors based on the same quality (luminosity and saturation) that is passed in.

public static Collection<GeoColor> GetColorsInQualityFamily(GeoColor baseColor, int numberOfColors)

Parameters

baseColor GeoColor

This parameter is the color on which you want to base the color collection.

numberOfColors int

This parameter represents the number of colors you want returned from the method.

Returns

Collection<GeoColor>

This method returns a collection of GeoColors based on the same quality (luminosity and saturation) that is passed in.

Remarks

This method is useful when you want to get a number of different colors that have the same quality. For example, you can use this in maps that represent countries or connected places. If you passed in bright red, then the method would return variants such as bright blue, bright green, etc. If you passed in dark red, you would get dark blue, dark green, etc.

Exceptions

ArgumentOutOfRangeException

If you pass in a numberOfColors value that is not between 1 and 255, it will throw a ArgumentOutOfRangeException.

GetColorsInQualityFamily(GeoColor, GeoColor, int, ColorWheelDirection)

Gets the colors in quality family.

public static Collection<GeoColor> GetColorsInQualityFamily(GeoColor fromColor, GeoColor toColor, int numberOfColors, ColorWheelDirection colorWheelDirection)

Parameters

fromColor GeoColor

From color.

toColor GeoColor

To color.

numberOfColors int

The number of colors.

colorWheelDirection ColorWheelDirection

The color wheel direction.

Returns

Collection<GeoColor>

GetHashCode()

This method is an override of the GetHashCode functionality.

public override int GetHashCode()

Returns

int

This method returns the hash code.

Remarks

None

GetRandomGeoColor(byte, RandomColorType)

Creates a random GeoColor structure

public static GeoColor GetRandomGeoColor(byte alpha, RandomColorType colorType)

Parameters

alpha byte

The alpha component. Valid values are 0 through 255.

colorType RandomColorType

A ColorType defines types of color.

Returns

GeoColor

A GeoColor structure the method created.

GetRandomGeoColor(RandomColorType)

Creates a random GeoColor structure based on the specific ColorType

public static GeoColor GetRandomGeoColor(RandomColorType colorType)

Parameters

colorType RandomColorType

A ColorType defines types of color.

Returns

GeoColor

A GeoColor structure the method created.

ToHtml(GeoColor)

This method returns an HTML color from a GeoColor.

public static string ToHtml(GeoColor color)

Parameters

color GeoColor

This parameter represents the GeoColor you want to convert.

Returns

string

This method returns an HTML color from a GeoColor.

Remarks

None

Exceptions

ArgumentNullException

If you pass a null as the drawingColor, we will throw an ArgumentNullException.

ToOle(GeoColor)

This method returns an OLE color from a GeoColor.

public static int ToOle(GeoColor color)

Parameters

color GeoColor

This parameter represents the GeoColor you want to convert.

Returns

int

This method returns an OLE color from a GeoColor.

Remarks

None

Exceptions

ArgumentNullException

If you pass a null as the drawingColor, we will throw an ArgumentNullException.

ToString()

Converts to string.

public override string ToString()

Returns

string

A string that represents this instance.

ToWin32(GeoColor)

This method returns a Win32 color from a GeoColor.

public static int ToWin32(GeoColor color)

Parameters

color GeoColor

This parameter represents the GeoColor you want to convert.

Returns

int

This method returns a Win32 color from a GeoColor.

Examples

None

Exceptions

ArgumentNullException

If you pass a null as the drawingColor, we will throw an ArgumentNullException.

Operators

operator ==(GeoColor, GeoColor)

This method is an override of the == functionality.

public static bool operator ==(GeoColor geoColor1, GeoColor geoColor2)

Parameters

geoColor1 GeoColor

This parameter represents the first GeoColor to compare.

geoColor2 GeoColor

This parameter represents the second GeoColor to compare.

Returns

bool

This method returns the equality of the two instances.

Remarks

None

Exceptions

ArgumentNullException

If you pass a null as the targetGeoColor, we will throw an ArgumentNullException.

ArgumentNullException

If you pass a null as the sourceGeoColor, we will throw an ArgumentNullException.

operator !=(GeoColor, GeoColor)

This method is an override of the != functionality.

public static bool operator !=(GeoColor geoColor1, GeoColor geoColor2)

Parameters

geoColor1 GeoColor

This parameter represents the first GeoColor to compare.

geoColor2 GeoColor

This parameter represents the second GeoColor to compare.

Returns

bool

This method returns the inequality of the two instances.

Remarks

None

Exceptions

ArgumentNullException

If you pass a null as the targetGeoColor, we will throw an ArgumentNullException.

ArgumentNullException

If you pass a null as the sourceGeoColor, we will throw an ArgumentNullException.