C# Class HFTColorUtils

显示文件 Open project: greggman/hft-unity-gamepad Class Usage Examples

Public Methods

Method Description
ColorToHSVA ( Color c ) : Vector4

Converts an RGBA color value to HSVA. Conversion formula adapted from http://en.wikipedia.org/wiki/HSV_color_space. Assumes r, g, and b are contained in the set [0, 1] and returns h, s, and v in the set [0, 1].

Fract ( float v ) : float
HSVAToColor ( Vector4 hsva ) : Color

Converts a HSVA color to a RGBA Color adapted from http://en.wikipedia.org/wiki/HSV_color_space. Assumes h, s, and v are contained in the set [0, 1] and returns r, g, and b in the set [0, 1].

Max ( Color c ) : float
Min ( Color c ) : float
MinMax ( float v, float min, float max ) : float
Saturate ( float v ) : float

Method Details

ColorToHSVA() public static method

Converts an RGBA color value to HSVA. Conversion formula adapted from http://en.wikipedia.org/wiki/HSV_color_space. Assumes r, g, and b are contained in the set [0, 1] and returns h, s, and v in the set [0, 1].
public static ColorToHSVA ( Color c ) : Vector4
c Color Color to convert
return Vector4

Fract() public static method

public static Fract ( float v ) : float
v float
return float

HSVAToColor() public static method

Converts a HSVA color to a RGBA Color adapted from http://en.wikipedia.org/wiki/HSV_color_space. Assumes h, s, and v are contained in the set [0, 1] and returns r, g, and b in the set [0, 1].
public static HSVAToColor ( Vector4 hsva ) : Color
hsva Vector4 Vector4 with h, s, v, a
return Color

Max() public static method

public static Max ( Color c ) : float
c Color
return float

Min() public static method

public static Min ( Color c ) : float
c Color
return float

MinMax() public static method

public static MinMax ( float v, float min, float max ) : float
v float
min float
max float
return float

Saturate() public static method

public static Saturate ( float v ) : float
v float
return float