[Core] Added ColorFromNormalized which is the reverse of ColorNormalize. (#1011)

This commit is contained in:
ChrisDill 2019-11-08 20:02:41 +00:00 committed by Ray
parent bba8454034
commit 00c611a5fb
2 changed files with 14 additions and 0 deletions

View File

@ -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)

View File

@ -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