[Core] Added ColorFromNormalized which is the reverse of ColorNormalize. (#1011)
This commit is contained in:
parent
bba8454034
commit
00c611a5fb
13
src/core.c
13
src/core.c
@ -1616,6 +1616,19 @@ Vector4 ColorNormalize(Color color)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Returns color from normalized values [0..1]
|
||||
Color ColorFromNormalized(Vector4 normalized)
|
||||
{
|
||||
Color result;
|
||||
|
||||
result.r = normalized.x*255.0f;
|
||||
result.g = normalized.y*255.0f;
|
||||
result.b = normalized.z*255.0f;
|
||||
result.a = normalized.w*255.0f;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Returns HSV values for a Color
|
||||
// NOTE: Hue is returned as degrees [0..360]
|
||||
Vector3 ColorToHSV(Color color)
|
||||
|
@ -924,6 +924,7 @@ RLAPI double GetTime(void); // Returns ela
|
||||
// Color-related functions
|
||||
RLAPI int ColorToInt(Color color); // Returns hexadecimal value for a Color
|
||||
RLAPI Vector4 ColorNormalize(Color color); // Returns color normalized as float [0..1]
|
||||
RLAPI Color ColorFromNormalized(Vector4 normalized); // Returns color from normalized values [0..1]
|
||||
RLAPI Vector3 ColorToHSV(Color color); // Returns HSV values for a Color
|
||||
RLAPI Color ColorFromHSV(Vector3 hsv); // Returns a Color from HSV values
|
||||
RLAPI Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value
|
||||
|
Loading…
Reference in New Issue
Block a user