Color |
public struct Color4 : IEquatable<Color4>, IFormattable
The Color4 type exposes the following members.
Name | Description | |
---|---|---|
Color4(Color3) | Initializes a new instance of the Color4 struct. | |
Color4(Single) | Initializes a new instance of the Color4 struct. | |
Color4(Single) | Initializes a new instance of the Color4 struct. | |
Color4(Vector4) | Initializes a new instance of the Color4 struct. | |
Color4(Color3, Single) | Initializes a new instance of the Color4 struct. | |
Color4(Int32, Format) | Initializes a new instance of the Color4 struct. | |
Color4(UInt32, Format) | Initializes a new instance of the Color4 struct. | |
Color4(Vector3, Single) | Initializes a new instance of the Color4 struct. | |
Color4(Single, Single, Single, Single) | Initializes a new instance of the Color4 struct. |
Name | Description | |
---|---|---|
Add(Color4, Color4) | Adds two colors. | |
Add(Color4, Color4, Color4) | Obsolete. Adds two colors. | |
AdjustContrast(Color4, Single) | Adjusts the contrast of a color. | |
AdjustContrast(Color4, Single, Color4) | Obsolete. Adjusts the contrast of a color. | |
AdjustSaturation(Color4, Single) | Adjusts the saturation of a color. | |
AdjustSaturation(Color4, Single, Color4) | Obsolete. Adjusts the saturation of a color. | |
Clamp(Color4, Color4, Color4) | Restricts a value to be within a specified range. | |
Clamp(Color4, Color4, Color4, Color4) | Obsolete. Restricts a value to be within a specified range. | |
Deconstruct | Deconstruct Color4 into tuple with red, green, blue and alpha values. | |
Equals(Color4) | Determines whether the specified Color4 is equal to this instance. | |
Equals(Color4) | Determines whether the specified Color4 is equal to this instance. | |
Equals(Object) |
Determines whether the specified Object is equal to this instance.
(Overrides ValueTypeEquals(Object)) | |
FromByteRgba | Gets Color4 from red, green, blue and alpha values defined as bytes (each value in range from 0 to 255) | |
FromHsl(Double, Double, Double, Double) | Gets Color4 from HSL (hue, saturation, lightness) | |
FromHsl(Single, Single, Single, Single) | Gets Color4 from HSL (hue, saturation, lightness) | |
FromHsv(Double, Double, Double, Double) | Gets Color4 from HSV (hue, saturation, value / brightness) | |
FromHsv(Single, Single, Single, Single) | Gets Color4 from HSV (hue, saturation, value / brightness) | |
GetHashCode |
Returns a hash code for this instance.
(Overrides ValueTypeGetHashCode) | |
IsSame | Returns true if byte values (each color is in range from 0 to 255) of this color are the same as byte values of the other colors. | |
Lerp(Color4, Color4, Single) | Performs a linear interpolation between two colors. | |
Lerp(Color4, Color4, Single, Color4) | Obsolete. Performs a linear interpolation between two colors. | |
Max(Color4, Color4) | Returns a color containing the largest components of the specified colors. | |
Max(Color4, Color4, Color4) | Obsolete. Returns a color containing the smallest components of the specified colors. | |
Min(Color4, Color4) | Returns a color containing the smallest components of the specified colors. | |
Min(Color4, Color4, Color4) | Obsolete. Returns a color containing the smallest components of the specified colors. | |
Modulate(Color4, Color4) | Modulates two colors. | |
Modulate(Color4, Color4, Color4) | Obsolete. Modulates two colors. | |
Negate(Color4) | Negates a color. | |
Negate(Color4, Color4) | Obsolete. Negates a color. | |
Parse | Parse method returns the color that was parsed from the color text. If the text cannot be parsed a FormatException is thrown (use TryParse(String, Color4) if you do not want to get an exception). When the color text starts with hash character (#), then the color is specified as a hex value in format RRGGBBAA, RGBA, RRGGBB or RGB (for example #FF0000FF for red color). Otherwise the color text should be one of the color names from the known colors defined in the Colors class. The name can be in any case. | |
Premultiply | Converts the color values to alpha premultiplied values. | |
Premultiply(Color4) | Computes the premultiplied value of the provided color. | |
Premultiply(Color4, Color4) | Obsolete. Computes the premultiplied value of the provided color. | |
Saturate | Update the color values to be between 0 and 1. | |
Saturate(Color4) | Obsolete. Restricts color values to be between 0 and 1. | |
SaturateAndPremultiply | Update the color values to be between 0 and 1 and premultiplies the values by alpha value. | |
Scale(Color4, Single) | Scales a color. | |
Scale(Color4, Single, Color4) | Obsolete. Scales a color. | |
SetAlpha | Sets the alpha value of this Color4. | |
SmoothStep(Color4, Color4, Single) | Performs a cubic interpolation between two colors. | |
SmoothStep(Color4, Color4, Single, Color4) | Obsolete. Performs a cubic interpolation between two colors. | |
Subtract(Color4, Color4) | Subtracts two colors. | |
Subtract(Color4, Color4, Color4) | Obsolete. Subtracts two colors. | |
ToArgb | Converts the color into a packed integer. | |
ToArray | Creates an array containing the elements of the color. | |
ToBgra | Converts the color into a packed integer. | |
ToHexString | Returns a string that represents a hex value of this color in format: RRGGBBAA, for example red color is "FF0000FF" | |
ToKnownColorString | If the color is one of the colors in the known Colors class, then the name of the color is returned. Otherwise a hex string with a hash ('#') prefix is returned. | |
ToRgba | Converts the color into a packed integer. | |
ToString |
Returns a String that represents this instance.
(Overrides ValueTypeToString) | |
ToString(IFormatProvider) | Returns a String that represents this instance. | |
ToString(String) | Returns a String that represents this instance. | |
ToString(String, IFormatProvider) | Returns a String that represents this instance. | |
ToVector3 | Converts the color into a three component vector. | |
ToVector4 | Converts the color into a four component vector. | |
TryParse | TryParse method tries to parse the color text and set the color out parameter. When the color text starts with hash character (#), then the color is specified as a hex value in format RRGGBBAA, RGBA, RRGGBB or RGB (for example #FF0000FF for red color). Otherwise the color text should be one of the color names from the known colors defined in the Colors class. The name can be in any case. When the color be parse, the color is set to the color out parameter and the method returns true. Otherwise color is set to Black color and the methods returns false. |
Name | Description | |
---|---|---|
Addition(Color4, Color4) | Adds two colors. | |
Equality(Color4, Color4) | Tests for equality between two objects. | |
(Color4 to Int32) | Performs an explicit conversion from Color4 to Int32. | |
(Color4 to Vector3) | Performs an explicit conversion from Color4 to Vector3. | |
(Color4 to UInt32) | Performs an explicit conversion from Color4 to UInt32. | |
(Int32 to Color4) | Performs an explicit conversion from Int32 to Color4. | |
(Vector3 to Color4) | Performs an explicit conversion from Vector3 to Color4. | |
(Vector4 to Color4) | Performs an explicit conversion from Vector4 to Color4. | |
(Color4 to Color3) | Performs an explicit conversion from Color4 to Color3. | |
(Color4 to Vector4) | Performs an implicit conversion from Color4 to Vector4. | |
Inequality(Color4, Color4) | Tests for inequality between two objects. | |
Multiply(Color4, Color4) | Modulates two colors. | |
Multiply(Color4, Single) | Scales a color. | |
Multiply(Single, Color4) | Scales a color. | |
Subtraction(Color4, Color4) | Subtracts two colors. | |
UnaryNegation(Color4) | Negates a color. | |
UnaryPlus(Color4) | Assert a color (return it unchanged). |
Name | Description | |
---|---|---|
Alpha | The alpha component of the color. | |
Black | The Black color (0, 0, 0, 1). | |
Blue | The blue component of the color. | |
Green | The green component of the color. | |
Red | The red component of the color. | |
Transparent | The Transparent color with alpha 0 and Red, Green and Blue set to 1.0. | |
White | The White color (1, 1, 1, 1). |
Name | Description | |
---|---|---|
Saturate |
Ensures that the color components are within 0 and 1 - if smaller than 0 than the value is set to 0; if bigger than 1 the value is set to 1. This is the same as saturate function in HLSL.
(Defined by Extensions) | |
Saturate |
Ensures that the color components are within 0 and 1 - if smaller than 0 than the value is set to 0; if bigger than 1 the value is set to 1. This is the same as saturate function in HLSL.
(Defined by Extensions) | |
Saturate |
Ensures that the color components are within 0 and 1 - if smaller than 0 than the value is set to 0; if bigger than 1 the value is set to 1. This is the same as saturate function in HLSL.
(Defined by Extensions) | |
ToAvaloniaColor |
Converts SharpEngine's Color4 to Avalonia color
(Defined by Extensions) | |
ToColor3 |
Converts Color4 to Color3
(Defined by Extensions) | |
ToWinUIColor |
Converts SharpEngine's Color4 to WinUI color
(Defined by Extensions) | |
ToWpfColor |
Converts SharpEngine's Color4 to WPF color
(Defined by Extensions) |