Class HSVColor
Contains helper-methods and extension for the Color-type to work in the HSV color space.
Inherited Members
Namespace: RGB.NET.Core
Assembly: RGB.NET.Core.dll
Syntax
public static class HSVColor
Methods
| Edit this page View SourceAddHSV(in Color, float, float, float)
Adds the specified HSV values to this color.
Declaration
public static Color AddHSV(this in Color color, float hue = 0, float saturation = 0, float value = 0)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to modify. |
float | hue | The hue value to add. |
float | saturation | The saturation value to add. |
float | value | The value value to add. |
Returns
Type | Description |
---|---|
Color | The new color after the modification. |
Create(byte, float, float, float)
Creates a new instance of the Color struct using AHSV-Values.
Declaration
public static Color Create(byte a, float hue, float saturation, float value)
Parameters
Type | Name | Description |
---|---|---|
byte | a | The alpha component value of this Color. |
float | hue | The hue component value of this Color. |
float | saturation | The saturation component value of this Color. |
float | value | The value component value of this Color. |
Returns
Type | Description |
---|---|
Color | The color created from the values. |
Create(int, float, float, float)
Creates a new instance of the Color struct using AHSV-Values.
Declaration
public static Color Create(int a, float hue, float saturation, float value)
Parameters
Type | Name | Description |
---|---|---|
int | a | The alpha component value of this Color. |
float | hue | The hue component value of this Color. |
float | saturation | The saturation component value of this Color. |
float | value | The value component value of this Color. |
Returns
Type | Description |
---|---|
Color | The color created from the values. |
Create(float, float, float)
Creates a new instance of the Color struct using HSV-Values.
Declaration
public static Color Create(float hue, float saturation, float value)
Parameters
Type | Name | Description |
---|---|---|
float | hue | The hue component value of this Color. |
float | saturation | The saturation component value of this Color. |
float | value | The value component value of this Color. |
Returns
Type | Description |
---|---|
Color | The color created from the values. |
Create(float, float, float, float)
Creates a new instance of the Color struct using AHSV-Values.
Declaration
public static Color Create(float a, float hue, float saturation, float value)
Parameters
Type | Name | Description |
---|---|---|
float | a | The alpha component value of this Color. |
float | hue | The hue component value of this Color. |
float | saturation | The saturation component value of this Color. |
float | value | The value component value of this Color. |
Returns
Type | Description |
---|---|
Color | The color created from the values. |
DivideHSV(in Color, float, float, float)
Divides the specified HSV values to this color.
Declaration
public static Color DivideHSV(this in Color color, float hue = 1, float saturation = 1, float value = 1)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to modify. |
float | hue | The hue value to divide. |
float | saturation | The saturation value to divide. |
float | value | The value value to divide. |
Returns
Type | Description |
---|---|
Color | The new color after the modification. |
GetHSV(in Color)
Gets the hue, saturation and value component values (HSV-color space) of this Color. Hue as degree in the range [0..1]. Saturation in the range [0..1]. Value in the range [0..1].
Declaration
public static (float hue, float saturation, float value) GetHSV(this in Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to get the value from. |
Returns
Type | Description |
---|---|
(float r, float g, float b) | A tuple containing the hue, saturation and value component value of the color. |
GetHue(in Color)
Gets the hue component value (HSV-color space) of this Color as degree in the range [0..360].
Declaration
public static float GetHue(this in Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to get the value from. |
Returns
Type | Description |
---|---|
float | The hue component value of the color. |
GetSaturation(in Color)
Gets the saturation component value (HSV-color space) of this Color in the range [0..1].
Declaration
public static float GetSaturation(this in Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to get the value from. |
Returns
Type | Description |
---|---|
float | The saturation component value of the color. |
GetValue(in Color)
Gets the value component value (HSV-color space) of this Color in the range [0..1].
Declaration
public static float GetValue(this in Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to get the value from. |
Returns
Type | Description |
---|---|
float | The value component value of the color. |
MultiplyHSV(in Color, float, float, float)
Multiplies the specified HSV values to this color.
Declaration
public static Color MultiplyHSV(this in Color color, float hue = 1, float saturation = 1, float value = 1)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to modify. |
float | hue | The hue value to multiply. |
float | saturation | The saturation value to multiply. |
float | value | The value value to multiply. |
Returns
Type | Description |
---|---|
Color | The new color after the modification. |
SetHSV(in Color, float?, float?, float?)
Sets the specified hue value of this color.
Declaration
public static Color SetHSV(this in Color color, float? hue = null, float? saturation = null, float? value = null)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to modify. |
float? | hue | The hue value to set. |
float? | saturation | The saturation value to set. |
float? | value | The value value to set. |
Returns
Type | Description |
---|---|
Color | The new color after the modification. |
SubtractHSV(in Color, float, float, float)
Subtracts the specified HSV values to this color.
Declaration
public static Color SubtractHSV(this in Color color, float hue = 0, float saturation = 0, float value = 0)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to modify. |
float | hue | The hue value to subtract. |
float | saturation | The saturation value to subtract. |
float | value | The value value to subtract. |
Returns
Type | Description |
---|---|
Color | The new color after the modification. |