[]
Represents a color in the form of rgba.
public struct ColorF : IEquatable<ColorF>, IFormattable
Initializes a new instance of the ColorF struct.
public ColorF(ColorF value, float alpha = 1)
value
ColorFThe source ColorF.
alpha
floatThe alpha component of the color.
Initializes a new instance of the ColorF struct.
public ColorF(Vector3 value, float alpha = 1)
value
Vector3The red, green, and blue components of the color.
alpha
floatThe alpha component of the color.
Initializes a new instance of the ColorF struct.
public ColorF(Vector4 value)
value
Vector4The red, green, blue, and alpha components of the color.
Initializes a new instance of the ColorF struct.
public ColorF(Color color)
color
System.Drawing.ColorThe System.Drawing.Color value.
Initializes a new instance of the ColorF struct.
public ColorF(float red, float green, float blue, float alpha = 1)
red
floatThe red component of the color.
green
floatThe green component of the color.
blue
floatThe blue component of the color.
alpha
floatThe alpha component of the color.
Initializes a new instance of the ColorF struct.
public ColorF(float value)
value
floatThe value that will be assigned to all components.
Initializes a new instance of the ColorF struct.
public ColorF(float[] values)
values
float[]The values to assign to the red, green, blue, and alpha components of the color. This must be an array with four elements.
Thrown when values
is null
.
Thrown when values
contains more or less than four elements.
Initializes a new instance of the ColorF struct.
[CLSCompliant(false)]
public ColorF(uint rgb, float alpha)
rgb
uintA packed unsigned integer containing three color components in RGB order.
alpha
floatThe alpha component of the color.
Initializes a new instance of the ColorF struct.
[CLSCompliant(false)]
public ColorF(uint argb)
argb
uintA packed unsigned integer containing all four color components in ARGB order.
The alpha component of the color.
public float A
AliceBlue color.
public static readonly ColorF AliceBlue
AntiqueWhite color.
public static readonly ColorF AntiqueWhite
Aqua color.
public static readonly ColorF Aqua
Aquamarine color.
public static readonly ColorF Aquamarine
Azure color.
public static readonly ColorF Azure
The blue component of the color.
public float B
Beige color.
public static readonly ColorF Beige
Bisque color.
public static readonly ColorF Bisque
Black color.
public static readonly ColorF Black
BlanchedAlmond color.
public static readonly ColorF BlanchedAlmond
Blue color.
public static readonly ColorF Blue
BlueViolet color.
public static readonly ColorF BlueViolet
Brown color.
public static readonly ColorF Brown
BurlyWood color.
public static readonly ColorF BurlyWood
CadetBlue color.
public static readonly ColorF CadetBlue
Chartreuse color.
public static readonly ColorF Chartreuse
Chocolate color.
public static readonly ColorF Chocolate
Coral color.
public static readonly ColorF Coral
CornflowerBlue color.
public static readonly ColorF CornflowerBlue
Cornsilk color.
public static readonly ColorF Cornsilk
Crimson color.
public static readonly ColorF Crimson
Cyan color.
public static readonly ColorF Cyan
DarkBlue color.
public static readonly ColorF DarkBlue
DarkCyan color.
public static readonly ColorF DarkCyan
DarkGoldenrod color.
public static readonly ColorF DarkGoldenrod
DarkGray color.
public static readonly ColorF DarkGray
DarkGreen color.
public static readonly ColorF DarkGreen
DarkKhaki color.
public static readonly ColorF DarkKhaki
DarkMagenta color.
public static readonly ColorF DarkMagenta
DarkOliveGreen color.
public static readonly ColorF DarkOliveGreen
DarkOrange color.
public static readonly ColorF DarkOrange
DarkOrchid color.
public static readonly ColorF DarkOrchid
DarkRed color.
public static readonly ColorF DarkRed
DarkSalmon color.
public static readonly ColorF DarkSalmon
DarkSeaGreen color.
public static readonly ColorF DarkSeaGreen
DarkSlateBlue color.
public static readonly ColorF DarkSlateBlue
DarkSlateGray color.
public static readonly ColorF DarkSlateGray
DarkTurquoise color.
public static readonly ColorF DarkTurquoise
DarkViolet color.
public static readonly ColorF DarkViolet
DeepPink color.
public static readonly ColorF DeepPink
DeepSkyBlue color.
public static readonly ColorF DeepSkyBlue
DimGray color.
public static readonly ColorF DimGray
DodgerBlue color.
public static readonly ColorF DodgerBlue
Empty color.
public static readonly ColorF Empty
Firebrick color.
public static readonly ColorF Firebrick
FloralWhite color.
public static readonly ColorF FloralWhite
ForestGreen color.
public static readonly ColorF ForestGreen
Fuchsia color.
public static readonly ColorF Fuchsia
The green component of the color.
public float G
Gainsboro color.
public static readonly ColorF Gainsboro
GhostWhite color.
public static readonly ColorF GhostWhite
Gold color.
public static readonly ColorF Gold
Goldenrod color.
public static readonly ColorF Goldenrod
Gray color.
public static readonly ColorF Gray
Green color.
public static readonly ColorF Green
GreenYellow color.
public static readonly ColorF GreenYellow
Honeydew color.
public static readonly ColorF Honeydew
HotPink color.
public static readonly ColorF HotPink
IndianRed color.
public static readonly ColorF IndianRed
Indigo color.
public static readonly ColorF Indigo
Ivory color.
public static readonly ColorF Ivory
Khaki color.
public static readonly ColorF Khaki
Lavender color.
public static readonly ColorF Lavender
LavenderBlush color.
public static readonly ColorF LavenderBlush
LawnGreen color.
public static readonly ColorF LawnGreen
LemonChiffon color.
public static readonly ColorF LemonChiffon
LightBlue color.
public static readonly ColorF LightBlue
LightCoral color.
public static readonly ColorF LightCoral
LightCyan color.
public static readonly ColorF LightCyan
LightGoldenrodYellow color.
public static readonly ColorF LightGoldenrodYellow
LightGray color.
public static readonly ColorF LightGray
LightGreen color.
public static readonly ColorF LightGreen
LightPink color.
public static readonly ColorF LightPink
LightSalmon color.
public static readonly ColorF LightSalmon
LightSeaGreen color.
public static readonly ColorF LightSeaGreen
LightSkyBlue color.
public static readonly ColorF LightSkyBlue
LightSlateGray color.
public static readonly ColorF LightSlateGray
LightSteelBlue color.
public static readonly ColorF LightSteelBlue
LightYellow color.
public static readonly ColorF LightYellow
Lime color.
public static readonly ColorF Lime
LimeGreen color.
public static readonly ColorF LimeGreen
Linen color.
public static readonly ColorF Linen
Magenta color.
public static readonly ColorF Magenta
Maroon color.
public static readonly ColorF Maroon
MediumAquamarine color.
public static readonly ColorF MediumAquamarine
MediumBlue color.
public static readonly ColorF MediumBlue
MediumOrchid color.
public static readonly ColorF MediumOrchid
MediumPurple color.
public static readonly ColorF MediumPurple
MediumSeaGreen color.
public static readonly ColorF MediumSeaGreen
MediumSlateBlue color.
public static readonly ColorF MediumSlateBlue
MediumSpringGreen color.
public static readonly ColorF MediumSpringGreen
MediumTurquoise color.
public static readonly ColorF MediumTurquoise
MediumVioletRed color.
public static readonly ColorF MediumVioletRed
MidnightBlue color.
public static readonly ColorF MidnightBlue
MintCream color.
public static readonly ColorF MintCream
MistyRose color.
public static readonly ColorF MistyRose
Moccasin color.
public static readonly ColorF Moccasin
NavajoWhite color.
public static readonly ColorF NavajoWhite
Navy color.
public static readonly ColorF Navy
OldLace color.
public static readonly ColorF OldLace
Olive color.
public static readonly ColorF Olive
OliveDrab color.
public static readonly ColorF OliveDrab
Orange color.
public static readonly ColorF Orange
OrangeRed color.
public static readonly ColorF OrangeRed
Orchid color.
public static readonly ColorF Orchid
PaleGoldenrod color.
public static readonly ColorF PaleGoldenrod
PaleGreen color.
public static readonly ColorF PaleGreen
PaleTurquoise color.
public static readonly ColorF PaleTurquoise
PaleVioletRed color.
public static readonly ColorF PaleVioletRed
PapayaWhip color.
public static readonly ColorF PapayaWhip
PeachPuff color.
public static readonly ColorF PeachPuff
Peru color.
public static readonly ColorF Peru
Pink color.
public static readonly ColorF Pink
Plum color.
public static readonly ColorF Plum
PowderBlue color.
public static readonly ColorF PowderBlue
Purple color.
public static readonly ColorF Purple
The red component of the color.
public float R
Red color.
public static readonly ColorF Red
RosyBrown color.
public static readonly ColorF RosyBrown
RoyalBlue color.
public static readonly ColorF RoyalBlue
SaddleBrown color.
public static readonly ColorF SaddleBrown
Salmon color.
public static readonly ColorF Salmon
SandyBrown color.
public static readonly ColorF SandyBrown
SeaGreen color.
public static readonly ColorF SeaGreen
SeaShell color.
public static readonly ColorF SeaShell
Sienna color.
public static readonly ColorF Sienna
Silver color.
public static readonly ColorF Silver
The size of the ColorF type, in bytes.
public const int SizeInBytes = 16
SkyBlue color.
public static readonly ColorF SkyBlue
SlateBlue color.
public static readonly ColorF SlateBlue
SlateGray color.
public static readonly ColorF SlateGray
Snow color.
public static readonly ColorF Snow
SpringGreen color.
public static readonly ColorF SpringGreen
SteelBlue color.
public static readonly ColorF SteelBlue
Tan color.
public static readonly ColorF Tan
Teal color.
public static readonly ColorF Teal
Thistle color.
public static readonly ColorF Thistle
Tomato color.
public static readonly ColorF Tomato
Transparent color.
public static readonly ColorF Transparent
Turquoise color.
public static readonly ColorF Turquoise
Violet color.
public static readonly ColorF Violet
Wheat color.
public static readonly ColorF Wheat
White color.
public static readonly ColorF White
WhiteSmoke color.
public static readonly ColorF WhiteSmoke
Yellow color.
public static readonly ColorF Yellow
YellowGreen color.
public static readonly ColorF YellowGreen
Gets whether this ColorF structure is uninitialized.
public bool IsEmpty { get; }
Gets a value indicating if we can skip drawing with this color.
public bool IsTransparent { get; }
Adjusts the contrast of a color.
public static ColorF AdjustContrast(ColorF value, float contrast)
value
ColorFThe color whose contrast is to be adjusted.
contrast
floatThe amount by which to adjust the contrast.
The adjusted color.
Adjusts the saturation of a color.
public static ColorF AdjustSaturation(ColorF value, float saturation)
value
ColorFThe color whose saturation is to be adjusted.
saturation
floatThe amount by which to adjust the saturation.
The adjusted color.
Determines whether the specified ColorF is equal to this instance.
public bool Equals(ColorF other)
other
ColorFDetermines whether the specified object is equal to this instance.
public override bool Equals(object value)
value
objectCreates a ColorF structure from the four ARGB component (alpha, red, green, and blue) values.
public static ColorF FromArgb(int alpha, int red, int green, int blue)
alpha
intred
intgreen
intblue
intCreates a ColorF structure from the specified 8-bit color values (red, green, and blue). The alpha value is implicitly fully opaque.
public static ColorF FromArgb(int red, int green, int blue)
red
intgreen
intblue
intConverts the color from an ARGB integer.
public static ColorF FromArgb(int argb)
argb
intA packed integer containing all four color components in ARGB order
A color.
Returns a hash code for this instance.
public override int GetHashCode()
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Performs a linear interpolation between two colors.
public static ColorF Lerp(ColorF start, ColorF end, float amount)
start
ColorFStart color.
end
ColorFEnd color.
amount
floatValue between 0 and 1 indicating the weight of end
.
The linear interpolation of the two colors.
This method performs the linear interpolation based on the following formula.
start + (end - start) * amount
Passing amount
a value of 0 will cause start
to be returned; a value of 1 will cause end
to be returned.
Performs a cubic interpolation between two colors.
public static ColorF SmoothStep(ColorF start, ColorF end, float amount)
start
ColorFStart color.
end
ColorFEnd color.
amount
floatValue between 0 and 1 indicating the weight of end
.
The cubic interpolation of the two colors.
Converts the color into a packed integer.
public int ToArgb()
A packed integer containing all four color components.
Creates an array containing the elements of the color.
public float[] ToArray()
A four-element array containing the components of the color.
Converts the color into a System.Drawing.Color.
public Color ToColor()
Returns a string that represents the current object.
public override string ToString()
Returns a string that represents this instance.
public string ToString(IFormatProvider formatProvider)
formatProvider
System.IFormatProviderThe format provider.
A string that represents this instance.
Returns a string that represents this instance.
public string ToString(string format, IFormatProvider formatProvider)
format
stringThe format.
formatProvider
System.IFormatProviderThe format provider.
A string that represents this instance.
Returns a string that represents this instance.
public string ToString(string format)
format
stringThe format.
A string that represents this instance.
Converts the color into a three component vector.
public Vector3 ToVector3()
A three component vector containing the red, green, and blue components of the color.
Converts the color into a four component vector.
public Vector4 ToVector4()
A four component vector containing all four color components.
Determines if the specified values are equal.
public static bool operator ==(ColorF left, ColorF right)
public static explicit operator Vector3(ColorF value)
value
ColorFThe value.
The result of the conversion.
Performs an explicit conversion from ColorF to System.Drawing.Color.
public static explicit operator Color(ColorF value)
value
ColorFpublic static explicit operator ColorF(Vector3 value)
value
Vector3The value.
The result of the conversion.
public static explicit operator ColorF(Vector4 value)
value
Vector4The value.
The result of the conversion.
Performs an explicit conversion from System.Drawing.Color to ColorF.
public static explicit operator ColorF(Color color)
color
System.Drawing.Colorpublic static implicit operator Vector4(ColorF value)
value
ColorFThe value.
The result of the conversion.
Determines if the specified values are not equal.
public static bool operator !=(ColorF left, ColorF right)