Gorgon
Show / Hide Table of Contents

Struct GorgonColor

An immutable 4 component (Red, Green, Blue, and Alpha) color value.

Implements
IGorgonEquatableByRef<GorgonColor>
IEquatable<GorgonColor>
ISerializable
Inherited Members
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetType()
Namespace: Gorgon.Graphics
Assembly: Gorgon.Core.dll
Syntax
[Serializable]
public readonly struct GorgonColor : IGorgonEquatableByRef<GorgonColor>, IEquatable<GorgonColor>, ISerializable
Remarks

This value type represents an RGBA (Red, Green, Blue, Alpha) color using a float for each color component.

Primarily this is used in graphical operations and can be converted to a Color value implicitly for use in System.Drawing operations.

Constructors

| Edit this page View Source

GorgonColor(GorgonColor, float)

Initializes a new instance of the GorgonColor struct.

Declaration
public GorgonColor(GorgonColor color, float alpha)
Parameters
Type Name Description
GorgonColor color

The base GorgonColor.

float alpha

The alpha value to assign to the color.

Remarks

This will retrieve the Red, Green, and Blue values from the parameter.

| Edit this page View Source

GorgonColor(Color)

Initializes a new instance of the GorgonColor struct.

Declaration
public GorgonColor(Color color)
Parameters
Type Name Description
Color color

A SharpDX color value.

| Edit this page View Source

GorgonColor(Color)

Initializes a new instance of the GorgonColor struct.

Declaration
public GorgonColor(Color color)
Parameters
Type Name Description
Color color

The Color that will be used to generate this GorgonColor.

| Edit this page View Source

GorgonColor(int)

Initializes a new instance of the GorgonColor struct.

Declaration
public GorgonColor(int argb)
Parameters
Type Name Description
int argb

An int value representing a color in ARGB format.

| Edit this page View Source

GorgonColor(Vector3)

Initializes a new instance of the GorgonColor struct.

Declaration
public GorgonColor(Vector3 color)
Parameters
Type Name Description
Vector3 color

The Vector3 that will be used to generate this GorgonColor.

Remarks

This will map the Vector3.X, Vector3.Y and Vector3.Z components to the Red, Green and Blue values respectively. The Alpha value is set to 1.0f (opaque) for this conversion.

| Edit this page View Source

GorgonColor(Vector4)

Initializes a new instance of the GorgonColor struct.

Declaration
public GorgonColor(Vector4 color)
Parameters
Type Name Description
Vector4 color

The Vector4 that will be used to generate this GorgonColor.

Remarks

This will map the Vector4.X, Vector4.Y, Vector4.Z and Vector4.W components to the Red, Green, Blue and Alpha values respectively.

| Edit this page View Source

GorgonColor(float, float, float)

Initializes a new instance of the GorgonColor struct.

Declaration
public GorgonColor(float r, float g, float b)
Parameters
Type Name Description
float r

The red component.

float g

The green component.

float b

The blue component.

| Edit this page View Source

GorgonColor(float, float, float, float)

Initializes a new instance of the GorgonColor struct.

Declaration
public GorgonColor(float r, float g, float b, float a)
Parameters
Type Name Description
float r

The red component.

float g

The green component.

float b

The blue component.

float a

The alpha component.

Fields

| Edit this page View Source

Alpha

The Alpha channel component.

Declaration
public readonly float Alpha
Field Value
Type Description
float
| Edit this page View Source

Aquamarine

Aquamarine.

Declaration
public static readonly GorgonColor Aquamarine
Field Value
Type Description
GorgonColor
| Edit this page View Source

Beige

Beige.

Declaration
public static readonly GorgonColor Beige
Field Value
Type Description
GorgonColor
| Edit this page View Source

Black

The color black.

Declaration
public static readonly GorgonColor Black
Field Value
Type Description
GorgonColor
| Edit this page View Source

BlackTransparent

A completely transparent color.

Declaration
public static readonly GorgonColor BlackTransparent
Field Value
Type Description
GorgonColor
| Edit this page View Source

BlanchedAlmond

WhiteSmoke.

Declaration
public static readonly GorgonColor BlanchedAlmond
Field Value
Type Description
GorgonColor
| Edit this page View Source

Blue

The Blue color channel component.

Declaration
public readonly float Blue
Field Value
Type Description
float
| Edit this page View Source

BluePure

Pure blue (Red = 0, Green = 0, Blue = 1).

Declaration
public static readonly GorgonColor BluePure
Field Value
Type Description
GorgonColor
| Edit this page View Source

BlueViolet

BlueViolet.

Declaration
public static readonly GorgonColor BlueViolet
Field Value
Type Description
GorgonColor
| Edit this page View Source

Brown

Brown.

Declaration
public static readonly GorgonColor Brown
Field Value
Type Description
GorgonColor
| Edit this page View Source

CadetBlue

CadetBlue.

Declaration
public static readonly GorgonColor CadetBlue
Field Value
Type Description
GorgonColor
| Edit this page View Source

Chartreuse

Chartreuse.

Declaration
public static readonly GorgonColor Chartreuse
Field Value
Type Description
GorgonColor
| Edit this page View Source

CornFlowerBlue

Corn flower blue.

Declaration
public static readonly GorgonColor CornFlowerBlue
Field Value
Type Description
GorgonColor
| Edit this page View Source

Crimson

Crimson.

Declaration
public static readonly GorgonColor Crimson
Field Value
Type Description
GorgonColor
| Edit this page View Source

CyanPure

Pure cyan (Red = 0, Green = 1, Blue = 1).

Declaration
public static readonly GorgonColor CyanPure
Field Value
Type Description
GorgonColor
| Edit this page View Source

DarkBlue

Dark blue.

Declaration
public static readonly GorgonColor DarkBlue
Field Value
Type Description
GorgonColor
| Edit this page View Source

DarkCyan

Dark cyan.

Declaration
public static readonly GorgonColor DarkCyan
Field Value
Type Description
GorgonColor
| Edit this page View Source

DarkGreen

Dark green.

Declaration
public static readonly GorgonColor DarkGreen
Field Value
Type Description
GorgonColor
| Edit this page View Source

DarkPurple

Dark purple.

Declaration
public static readonly GorgonColor DarkPurple
Field Value
Type Description
GorgonColor
| Edit this page View Source

DarkRed

Dark red.

Declaration
public static readonly GorgonColor DarkRed
Field Value
Type Description
GorgonColor
| Edit this page View Source

DarkYellow

Dark yellow.

Declaration
public static readonly GorgonColor DarkYellow
Field Value
Type Description
GorgonColor
| Edit this page View Source

DeepPink

DeepPink.

Declaration
public static readonly GorgonColor DeepPink
Field Value
Type Description
GorgonColor
| Edit this page View Source

DeepSkyBlue

DeepSkyBlue.

Declaration
public static readonly GorgonColor DeepSkyBlue
Field Value
Type Description
GorgonColor
| Edit this page View Source

Firebrick

Firebrick.

Declaration
public static readonly GorgonColor Firebrick
Field Value
Type Description
GorgonColor
| Edit this page View Source

Gold

Gold.

Declaration
public static readonly GorgonColor Gold
Field Value
Type Description
GorgonColor
| Edit this page View Source

Gray10

10% gray.

Declaration
public static readonly GorgonColor Gray10
Field Value
Type Description
GorgonColor
| Edit this page View Source

Gray20

20% gray.

Declaration
public static readonly GorgonColor Gray20
Field Value
Type Description
GorgonColor
| Edit this page View Source

Gray25

25% gray.

Declaration
public static readonly GorgonColor Gray25
Field Value
Type Description
GorgonColor
| Edit this page View Source

Gray30

30% gray.

Declaration
public static readonly GorgonColor Gray30
Field Value
Type Description
GorgonColor
| Edit this page View Source

Gray40

40% gray.

Declaration
public static readonly GorgonColor Gray40
Field Value
Type Description
GorgonColor
| Edit this page View Source

Gray50

50% gray.

Declaration
public static readonly GorgonColor Gray50
Field Value
Type Description
GorgonColor
| Edit this page View Source

Gray60

60% gray.

Declaration
public static readonly GorgonColor Gray60
Field Value
Type Description
GorgonColor
| Edit this page View Source

Gray70

70% gray.

Declaration
public static readonly GorgonColor Gray70
Field Value
Type Description
GorgonColor
| Edit this page View Source

Gray75

75% gray.

Declaration
public static readonly GorgonColor Gray75
Field Value
Type Description
GorgonColor
| Edit this page View Source

Gray80

80% gray.

Declaration
public static readonly GorgonColor Gray80
Field Value
Type Description
GorgonColor
| Edit this page View Source

Gray90

90% gray.

Declaration
public static readonly GorgonColor Gray90
Field Value
Type Description
GorgonColor
| Edit this page View Source

Green

The Green color channel component.

Declaration
public readonly float Green
Field Value
Type Description
float
| Edit this page View Source

GreenPure

Pure green (Red = 0, Green = 1, Blue = 0).

Declaration
public static readonly GorgonColor GreenPure
Field Value
Type Description
GorgonColor
| Edit this page View Source

LightBlue

Light blue.

Declaration
public static readonly GorgonColor LightBlue
Field Value
Type Description
GorgonColor
| Edit this page View Source

LightCyan

Light cyan.

Declaration
public static readonly GorgonColor LightCyan
Field Value
Type Description
GorgonColor
| Edit this page View Source

LightGreen

Light green.

Declaration
public static readonly GorgonColor LightGreen
Field Value
Type Description
GorgonColor
| Edit this page View Source

LightPurple

Light purple.

Declaration
public static readonly GorgonColor LightPurple
Field Value
Type Description
GorgonColor
| Edit this page View Source

LightRed

Light red.

Declaration
public static readonly GorgonColor LightRed
Field Value
Type Description
GorgonColor
| Edit this page View Source

LightYellow

Light yellow.

Declaration
public static readonly GorgonColor LightYellow
Field Value
Type Description
GorgonColor
| Edit this page View Source

Orange

Orange.

Declaration
public static readonly GorgonColor Orange
Field Value
Type Description
GorgonColor
| Edit this page View Source

OrangeRed

OrangeRed.

Declaration
public static readonly GorgonColor OrangeRed
Field Value
Type Description
GorgonColor
| Edit this page View Source

PurplePure

Pure purple (Red = 1, Green = 0, Blue = 1).

Declaration
public static readonly GorgonColor PurplePure
Field Value
Type Description
GorgonColor
| Edit this page View Source

Red

The Red color channel component.

Declaration
public readonly float Red
Field Value
Type Description
float
| Edit this page View Source

RedPure

Pure red (Red = 1, Green = 0, Blue = 0).

Declaration
public static readonly GorgonColor RedPure
Field Value
Type Description
GorgonColor
| Edit this page View Source

SaddleBrown

Saddle brown.

Declaration
public static readonly GorgonColor SaddleBrown
Field Value
Type Description
GorgonColor
| Edit this page View Source

SeaGreen

SeaGreen.

Declaration
public static readonly GorgonColor SeaGreen
Field Value
Type Description
GorgonColor
| Edit this page View Source

SizeInBytes

The size of the value, in bytes.

Declaration
public static readonly int SizeInBytes
Field Value
Type Description
int
| Edit this page View Source

SteelBlue

Steel blue.

Declaration
public static readonly GorgonColor SteelBlue
Field Value
Type Description
GorgonColor
| Edit this page View Source

Transparent

A completely transparent color.

Declaration
public static readonly GorgonColor Transparent
Field Value
Type Description
GorgonColor
| Edit this page View Source

White

The color white.

Declaration
public static readonly GorgonColor White
Field Value
Type Description
GorgonColor
| Edit this page View Source

WhiteSmoke

WhiteSmoke.

Declaration
public static readonly GorgonColor WhiteSmoke
Field Value
Type Description
GorgonColor
| Edit this page View Source

YellowGreen

Yellow green.

Declaration
public static readonly GorgonColor YellowGreen
Field Value
Type Description
GorgonColor
| Edit this page View Source

YellowPure

Pure yellow (Red = 1, Green = 1, Blue = 0).

Declaration
public static readonly GorgonColor YellowPure
Field Value
Type Description
GorgonColor

Methods

| Edit this page View Source

Add(GorgonColor, GorgonColor)

Function to add two GorgonColor values together.

Declaration
public static GorgonColor Add(GorgonColor left, GorgonColor right)
Parameters
Type Name Description
GorgonColor left

The left color to add.

GorgonColor right

The right color to add.

Returns
Type Description
GorgonColor

The total of the two colors.

Remarks

This method does not clamp its output. Values greater than 1 or less than 0 are possible.

| Edit this page View Source

Add(in GorgonColor, in GorgonColor, out GorgonColor)

Function to add two GorgonColor values together.

Declaration
public static void Add(in GorgonColor left, in GorgonColor right, out GorgonColor outColor)
Parameters
Type Name Description
GorgonColor left

The left color to add.

GorgonColor right

The right color to add.

GorgonColor outColor

The total of the two colors.

Remarks

This method does not clamp its output. Values greater than 1 or less than 0 are possible.

| Edit this page View Source

ApplyGamma(float)

Function to apply a gamma value to this color to increase or decrease its intensity.

Declaration
public GorgonColor ApplyGamma(float gammaValue)
Parameters
Type Name Description
float gammaValue

The gamma value to apply.

Returns
Type Description
GorgonColor

The adjusted color.

| Edit this page View Source

Clamp(GorgonColor)

Function to clamp the color ranges from 0 to 1.

Declaration
public static GorgonColor Clamp(GorgonColor color)
Parameters
Type Name Description
GorgonColor color

The color to clamp.

Returns
Type Description
GorgonColor

The clamped color.

| Edit this page View Source

Clamp(in GorgonColor, out GorgonColor)

Function to clamp the color ranges from 0 to 1.

Declaration
public static void Clamp(in GorgonColor color, out GorgonColor result)
Parameters
Type Name Description
GorgonColor color

The color to clamp.

GorgonColor result

The clamped color.

| Edit this page View Source

Deconstruct(out float, out float, out float, out float)

Function to deconstruct the color into individual color components.

Declaration
public void Deconstruct(out float r, out float g, out float b, out float a)
Parameters
Type Name Description
float r

The red component for the color.

float g

The green component for the color.

float b

The blue component for the color.

float a

The alpha component for the color.

| Edit this page View Source

Equals(GorgonColor)

Indicates whether the current object is equal to another object of the same type.

Declaration
public bool Equals(GorgonColor other)
Parameters
Type Name Description
GorgonColor other

An object to compare with this object.

Returns
Type Description
bool

true if the current object is equal to the parameter; otherwise, false.

| Edit this page View Source

Equals(in GorgonColor)

Indicates whether the current object is equal to another object of the same type by reference.

Declaration
public bool Equals(in GorgonColor other)
Parameters
Type Name Description
GorgonColor other

An object to compare with this object.

Returns
Type Description
bool

true if the current object is equal to the parameter; otherwise, false.

| Edit this page View Source

Equals(in GorgonColor, in GorgonColor)

Function to compare two colors for equality.

Declaration
public static bool Equals(in GorgonColor left, in GorgonColor right)
Parameters
Type Name Description
GorgonColor left

Left color to compare.

GorgonColor right

Right color to compare.

Returns
Type Description
bool

true if equal, false if not.

| Edit this page View Source

Equals(object)

Determines whether the specified object is equal to this instance.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
object obj

The object to compare with this instance.

Returns
Type Description
bool

true if the specified object is equal to this instance; otherwise, false.

Overrides
ValueType.Equals(object)
| Edit this page View Source

FromABGR(int)

Function to convert a ABGR color into a GorgonColor.

Declaration
public static GorgonColor FromABGR(int abgrColor)
Parameters
Type Name Description
int abgrColor

An int representing the color in ABGR format.

Returns
Type Description
GorgonColor

The GorgonColor representation.

| Edit this page View Source

FromBGRA(int)

Function to convert a BGRA color into a GorgonColor.

Declaration
public static GorgonColor FromBGRA(int bgraColor)
Parameters
Type Name Description
int bgraColor

An int representing the color in BGRA format.

Returns
Type Description
GorgonColor

The GorgonColor representation.

| Edit this page View Source

FromRGBA(int)

Function to convert a RGBA color into a GorgonColor.

Declaration
public static GorgonColor FromRGBA(int rgbaColor)
Parameters
Type Name Description
int rgbaColor

An int representing the color in RGBA format.

Returns
Type Description
GorgonColor

The GorgonColor representation.

| Edit this page View Source

GetHashCode()

Returns a hash code for this instance.

Declaration
public override int GetHashCode()
Returns
Type Description
int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

Overrides
ValueType.GetHashCode()
| Edit this page View Source

GetIntegerComponents()

Function to deconstruct the color into individual color components.

Declaration
public (int R, int G, int B, int A) GetIntegerComponents()
Returns
Type Description
(int R, int G, int B, int A)

A tuple containing the color channels as integer values scaled from 0 to 255.

| Edit this page View Source

Lerp(GorgonColor, GorgonColor, float)

Function to perform linear interpolation between two GorgonColor values.

Declaration
public static GorgonColor Lerp(GorgonColor start, GorgonColor end, float weight)
Parameters
Type Name Description
GorgonColor start

The starting GorgonColor.

GorgonColor end

The ending GorgonColor.

float weight

Value between 0 and 1.0f to indicate weighting between start and end.

Returns
Type Description
GorgonColor

The new GorgonColor representing a color between the and values.

Remarks

This will compute a new GorgonColor from the and parameters based on the passed in. For example, if the is Red = 0, Green = 0, Blue = 0, and Alpha = 0, and the is Red = 1, Green = 0, Blue = 1, and Alpha 0.5f. Then, with a of 0.5f, the result will be Red = 0.5f, Green = 0, Blue = 0.5f, and an Alpha = 0.25f.

| Edit this page View Source

Lerp(in GorgonColor, in GorgonColor, float, out GorgonColor)

Function to perform linear interpolation between two GorgonColor values.

Declaration
public static void Lerp(in GorgonColor start, in GorgonColor end, float weight, out GorgonColor outColor)
Parameters
Type Name Description
GorgonColor start

The starting GorgonColor.

GorgonColor end

The ending GorgonColor.

float weight

Value between 0 and 1.0f to indicate weighting between start and end.

GorgonColor outColor

The new GorgonColor representing a color between the and values.

Remarks

This will compute a new GorgonColor from the and parameters based on the passed in. For example, if the is Red = 0, Green = 0, Blue = 0, and Alpha = 0, and the is Red = 1, Green = 0, Blue = 1, and Alpha 0.5f. Then, with a of 0.5f, the result will be Red = 0.5f, Green = 0, Blue = 0.5f, and an Alpha = 0.25f.

| Edit this page View Source

Multiply(GorgonColor, GorgonColor)

Function to multiply two GorgonColor values together.

Declaration
public static GorgonColor Multiply(GorgonColor left, GorgonColor right)
Parameters
Type Name Description
GorgonColor left

The left color to multiply.

GorgonColor right

The right color to multiply.

Returns
Type Description
GorgonColor

Product of the two colors.

| Edit this page View Source

Multiply(GorgonColor, float)

Function to multiply a GorgonColor by a value.

Declaration
public static GorgonColor Multiply(GorgonColor color, float value)
Parameters
Type Name Description
GorgonColor color

The color to multiply.

float value

The value to multiply.

Returns
Type Description
GorgonColor

Product of the and the .

| Edit this page View Source

Multiply(in GorgonColor, in GorgonColor, out GorgonColor)

Function to multiply two GorgonColor values together.

Declaration
public static void Multiply(in GorgonColor left, in GorgonColor right, out GorgonColor outColor)
Parameters
Type Name Description
GorgonColor left

The left color to multiply.

GorgonColor right

The right color to multiply.

GorgonColor outColor

Product of the two colors.

| Edit this page View Source

Multiply(in GorgonColor, float, out GorgonColor)

Function to multiply a GorgonColor by a value.

Declaration
public static void Multiply(in GorgonColor color, float value, out GorgonColor outColor)
Parameters
Type Name Description
GorgonColor color

The color to multiply.

float value

The value to multiply.

GorgonColor outColor

Product of the and the .

| Edit this page View Source

SetAlpha(GorgonColor, float)

Function to apply an alpha value to the specified GorgonColor.

Declaration
public static GorgonColor SetAlpha(GorgonColor color, float alpha)
Parameters
Type Name Description
GorgonColor color

The GorgonColor to update.

float alpha

The alpha value to set.

Returns
Type Description
GorgonColor

A new GorgonColor instance with the same Red, Green, and Blue values but with a modified Alpha component.

| Edit this page View Source

SetAlpha(in GorgonColor, float, out GorgonColor)

Function to apply an alpha value to the specified GorgonColor.

Declaration
public static void SetAlpha(in GorgonColor color, float alpha, out GorgonColor result)
Parameters
Type Name Description
GorgonColor color

The GorgonColor to update.

float alpha

The alpha value to set.

GorgonColor result

The resulting updated GorgonColor.

| Edit this page View Source

Subtract(GorgonColor, GorgonColor)

Function to subtract two GorgonColor values from each other.

Declaration
public static GorgonColor Subtract(GorgonColor left, GorgonColor right)
Parameters
Type Name Description
GorgonColor left

The left color to subtract.

GorgonColor right

The right color to subtract.

Returns
Type Description
GorgonColor

The difference between the two colors.

Remarks

This method does not clamp its output. Values greater than 1 or less than 0 are possible.

| Edit this page View Source

Subtract(in GorgonColor, in GorgonColor, out GorgonColor)

Function to subtract two GorgonColor values from each other.

Declaration
public static void Subtract(in GorgonColor left, in GorgonColor right, out GorgonColor outColor)
Parameters
Type Name Description
GorgonColor left

The left color to subtract.

GorgonColor right

The right color to subtract.

GorgonColor outColor

The difference between the two colors.

Remarks

This method does not clamp its output. Values greater than 1 or less than 0 are possible.

| Edit this page View Source

ToABGR()

Function to convert this GorgonColor value into an int value with a ABGR format.

Declaration
[Pure]
public int ToABGR()
Returns
Type Description
int

An int representing the color value in ARGB format.

Remarks

The format indicates the byte position of each color component in the int value.

| Edit this page View Source

ToARGB()

Function to convert this GorgonColor value into an int value with a ARGB format.

Declaration
[Pure]
public int ToARGB()
Returns
Type Description
int

An int representing the color value in ARGB format.

Remarks

The format indicates the byte position of each color component in the int value.

| Edit this page View Source

ToBGRA()

Function to convert this GorgonColor value into an int value with a BGRA format.

Declaration
[Pure]
public int ToBGRA()
Returns
Type Description
int

An int representing the color value in ARGB format.

Remarks

The format indicates the byte position of each color component in the int value.

| Edit this page View Source

ToColor()

Function to convert this GorgonColor into a Color.

Declaration
[Pure]
public Color ToColor()
Returns
Type Description
Color

The Color value.

| Edit this page View Source

ToColor(GorgonColor)

Function to perform an implicit conversion from GorgonColor to Color.

Declaration
public static Color ToColor(GorgonColor color)
Parameters
Type Name Description
GorgonColor color

The color to convert.

Returns
Type Description
Color

The result of the conversion.

| Edit this page View Source

ToGorgonColor(Color)

Function to perform an implicit conversion from a SharpDX.Color to GorgonColor.

Declaration
public static GorgonColor ToGorgonColor(Color color)
Parameters
Type Name Description
Color color

The color to convert.

Returns
Type Description
GorgonColor

The result of the conversion.

| Edit this page View Source

ToGorgonColor(Color)

Function to perform an implicit conversion from Color to GorgonColor.

Declaration
public static GorgonColor ToGorgonColor(Color color)
Parameters
Type Name Description
Color color

The color to convert.

Returns
Type Description
GorgonColor

The result of the conversion.

| Edit this page View Source

ToGorgonColor(int)

Function to perform an implicit conversion from int to GorgonColor.

Declaration
public static GorgonColor ToGorgonColor(int color)
Parameters
Type Name Description
int color

The color.

Returns
Type Description
GorgonColor

The result of the conversion.

Remarks

This operator assumes the is in ARGB format.

| Edit this page View Source

ToGorgonColor(Vector3)

Function to perform an explicit conversion from Vector3 to GorgonColor.

Declaration
public static GorgonColor ToGorgonColor(Vector3 color)
Parameters
Type Name Description
Vector3 color

The color.

Returns
Type Description
GorgonColor

The result of the conversion.

Remarks

This will map the Vector3.X, Vector3.Y and Vector3.Z components to the Red, Green and Blue values respectively. The Alpha value is set to 1.0f (opaque) for this conversion.

| Edit this page View Source

ToGorgonColor(Vector4)

Function to perform an implicit conversion from Vector4 to GorgonColor.

Declaration
public static GorgonColor ToGorgonColor(Vector4 color)
Parameters
Type Name Description
Vector4 color

The color.

Returns
Type Description
GorgonColor

The result of the conversion.

Remarks

This will map the Vector4.X, Vector4.Y, Vector4.Z and Vector4.W components to the Red, Green, Blue and Alpha values respectively.

| Edit this page View Source

ToHex()

Function to convert this GorgonColor value into a hexadecimal formatting string.

Declaration
[Pure]
public string ToHex()
Returns
Type Description
string

The color represented as a hexadecimal string.

Remarks

The format of the string will be as follows: AARRGGBB.

| Edit this page View Source

ToInt32(GorgonColor)

Function to perform an implicit conversion from GorgonColor to int.

Declaration
public static int ToInt32(GorgonColor color)
Parameters
Type Name Description
GorgonColor color

The color to convert.

Returns
Type Description
int

The result of the conversion.

Remarks

This will return the color in ARGB format.

| Edit this page View Source

ToLinear()

Function to convert the sRGB version of the color to a linear color value.

Declaration
[Pure]
public GorgonColor ToLinear()
Returns
Type Description
GorgonColor

The linear color value.

| Edit this page View Source

ToRGBA()

Function to convert this GorgonColor value into an int value with a RGBA format.

Declaration
[Pure]
public int ToRGBA()
Returns
Type Description
int

An int representing the color value in ARGB format.

Remarks

The format indicates the byte position of each color component in the int value.

| Edit this page View Source

ToSRgb()

Function to convert the linear version of the color to a sRGB color value.

Declaration
[Pure]
public GorgonColor ToSRgb()
Returns
Type Description
GorgonColor

The linear color value.

| Edit this page View Source

ToSharpDXColor()

Function to conver this GorgonColor into a SharpDX.Color.

Declaration
[Pure]
public Color ToSharpDXColor()
Returns
Type Description
Color

The SharpDX.Color value.

| Edit this page View Source

ToSharpDXColor(GorgonColor)

Function to perform an implicit conversion from GorgonColor to a SharpDX.Color.

Declaration
public static Color ToSharpDXColor(GorgonColor color)
Parameters
Type Name Description
GorgonColor color

The color to convert.

Returns
Type Description
Color

The SharpDX color.

| Edit this page View Source

ToString()

Returns a string that represents this instance.

Declaration
public override string ToString()
Returns
Type Description
string

A string that represents this instance.

Overrides
ValueType.ToString()
| Edit this page View Source

ToVector3()

Function to convert this GorgonColor into a Vector3.

Declaration
[Pure]
public Vector3 ToVector3()
Returns
Type Description
Vector3

The Vector3 value.

Remarks

This will map the Red, Green and Blue components to the Vector3.X, Vector3.Y and Vector3.Z values respectively.

| Edit this page View Source

ToVector3(GorgonColor)

Function to perform an explicit conversion from GorgonColor to Vector3.

Declaration
public static Vector3 ToVector3(GorgonColor color)
Parameters
Type Name Description
GorgonColor color

The color.

Returns
Type Description
Vector3

The result of the conversion.

Remarks

This will map the Red, Green and Blue components to the Vector3.X, Vector3.Y and Vector3.Z values respectively.

| Edit this page View Source

ToVector4()

Function to convert this GorgonColor into a Vector4.

Declaration
[Pure]
public Vector4 ToVector4()
Returns
Type Description
Vector4

The Vector4 value.

Remarks

This will map the Red, Green, Blue and Alpha components to the Vector4.X, Vector4.Y, Vector4.Z and Vector4.W values respectively.

| Edit this page View Source

ToVector4(GorgonColor)

Function to perform an implicit conversion from GorgonColor to Vector4.

Declaration
public static Vector4 ToVector4(GorgonColor color)
Parameters
Type Name Description
GorgonColor color

The color.

Returns
Type Description
Vector4

The result of the conversion.

Remarks

This will map the Red, Green, Blue and Alpha components to the Vector4.X, Vector4.Y, Vector4.Z and Vector4.W values respectively.

Operators

| Edit this page View Source

operator +(GorgonColor, GorgonColor)

An operator to add two GorgonColor values together.

Declaration
public static GorgonColor operator +(GorgonColor left, GorgonColor right)
Parameters
Type Name Description
GorgonColor left

The left value.

GorgonColor right

The right value.

Returns
Type Description
GorgonColor

The result of the operator.

Remarks

This method does not clamp its output. Values greater than 1 or less than 0 are possible.

| Edit this page View Source

operator ==(GorgonColor, GorgonColor)

An operator to determine if two instances are equal.

Declaration
public static bool operator ==(GorgonColor left, GorgonColor right)
Parameters
Type Name Description
GorgonColor left

The left value.

GorgonColor right

The right value.

Returns
Type Description
bool

true if equal, false if not.

| Edit this page View Source

explicit operator Vector3(GorgonColor)

Performs an explicit conversion from GorgonColor to Vector3.

Declaration
public static explicit operator Vector3(GorgonColor color)
Parameters
Type Name Description
GorgonColor color

The color.

Returns
Type Description
Vector3

The result of the conversion.

Remarks

This will map the Red, Green and Blue components to the Vector3.X, Vector3.Y and Vector3.Z values respectively.

| Edit this page View Source

explicit operator GorgonColor(Vector3)

Performs an explicit conversion from Vector3 to GorgonColor.

Declaration
public static explicit operator GorgonColor(Vector3 color)
Parameters
Type Name Description
Vector3 color

The color.

Returns
Type Description
GorgonColor

The result of the conversion.

Remarks

This will map the Vector3.X, Vector3.Y and Vector3.Z components to the Red, Green and Blue values respectively. The Alpha value is set to 1.0f (opaque) for this conversion.

| Edit this page View Source

implicit operator Color(GorgonColor)

Performs an implicit conversion from GorgonColor to a SharpDX.Color.

Declaration
public static implicit operator Color(GorgonColor color)
Parameters
Type Name Description
GorgonColor color

The color to convert.

Returns
Type Description
Color

The result of the conversion.

| Edit this page View Source

implicit operator Color(GorgonColor)

Performs an implicit conversion from GorgonColor to Color.

Declaration
public static implicit operator Color(GorgonColor color)
Parameters
Type Name Description
GorgonColor color

The color to convert.

Returns
Type Description
Color

The result of the conversion.

| Edit this page View Source

implicit operator int(GorgonColor)

Performs an implicit conversion from GorgonColor to int.

Declaration
public static implicit operator int(GorgonColor color)
Parameters
Type Name Description
GorgonColor color

The color to convert.

Returns
Type Description
int

The result of the conversion.

Remarks

This will return the color in ARGB format.

| Edit this page View Source

implicit operator Vector4(GorgonColor)

Performs an implicit conversion from GorgonColor to Vector4.

Declaration
public static implicit operator Vector4(GorgonColor color)
Parameters
Type Name Description
GorgonColor color

The color.

Returns
Type Description
Vector4

The result of the conversion.

Remarks

This will map the Red, Green, Blue and Alpha components to the Vector4.X, Vector4.Y, Vector4.Z and Vector4.W values respectively.

| Edit this page View Source

implicit operator GorgonColor(Color)

Performs an implicit conversion from a SharpDX.Color to a GorgonColor.

Declaration
public static implicit operator GorgonColor(Color color)
Parameters
Type Name Description
Color color

The color to convert.

Returns
Type Description
GorgonColor

The result of the conversion.

| Edit this page View Source

implicit operator GorgonColor(Color)

Performs an implicit conversion from Color to GorgonColor.

Declaration
public static implicit operator GorgonColor(Color color)
Parameters
Type Name Description
Color color

The color to convert.

Returns
Type Description
GorgonColor

The result of the conversion.

| Edit this page View Source

implicit operator GorgonColor(int)

Performs an implicit conversion from int to GorgonColor.

Declaration
public static implicit operator GorgonColor(int color)
Parameters
Type Name Description
int color

The color.

Returns
Type Description
GorgonColor

The result of the conversion.

Remarks

This operator assumes the is in ARGB format.

| Edit this page View Source

implicit operator GorgonColor(Vector4)

Performs an implicit conversion from Vector4 to GorgonColor.

Declaration
public static implicit operator GorgonColor(Vector4 color)
Parameters
Type Name Description
Vector4 color

The color.

Returns
Type Description
GorgonColor

The result of the conversion.

Remarks

This will map the Vector4.X, Vector4.Y, Vector4.Z and Vector4.W components to the Red, Green, Blue and Alpha values respectively.

| Edit this page View Source

operator !=(GorgonColor, GorgonColor)

An operator to determine if two instances are not equal.

Declaration
public static bool operator !=(GorgonColor left, GorgonColor right)
Parameters
Type Name Description
GorgonColor left

The left value.

GorgonColor right

The right value.

Returns
Type Description
bool

true if not equal, false if equal.

| Edit this page View Source

operator *(GorgonColor, GorgonColor)

An operator to multiply two GorgonColor values together.

Declaration
public static GorgonColor operator *(GorgonColor left, GorgonColor right)
Parameters
Type Name Description
GorgonColor left

The left value.

GorgonColor right

The right value.

Returns
Type Description
GorgonColor

The result of the operator.

| Edit this page View Source

operator *(GorgonColor, float)

An operator to multiply a GorgonColor and a float value.

Declaration
public static GorgonColor operator *(GorgonColor color, float value)
Parameters
Type Name Description
GorgonColor color

The color to multiply.

float value

The value to multiply by.

Returns
Type Description
GorgonColor

The result of the operator.

| Edit this page View Source

operator -(GorgonColor, GorgonColor)

An operator to subtract two GorgonColor values from each other.

Declaration
public static GorgonColor operator -(GorgonColor left, GorgonColor right)
Parameters
Type Name Description
GorgonColor left

The left value.

GorgonColor right

The right value.

Returns
Type Description
GorgonColor

The result of the operator.

Remarks

This method does not clamp its output. Values greater than 1 or less than 0 are possible.

Implements

IGorgonEquatableByRef<T>
IEquatable<T>
ISerializable

Extension Methods

GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author