Replaced ColorToFloat() by ColorNormalize()
This commit is contained in:
parent
8d81b6e4e4
commit
dff1028466
26
src/core.c
26
src/core.c
@ -1156,25 +1156,25 @@ double GetTime(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
// Returns normalized float array for a Color
|
||||
float *ColorToFloat(Color color)
|
||||
{
|
||||
static float buffer[4];
|
||||
|
||||
buffer[0] = (float)color.r/255;
|
||||
buffer[1] = (float)color.g/255;
|
||||
buffer[2] = (float)color.b/255;
|
||||
buffer[3] = (float)color.a/255;
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// Returns hexadecimal value for a Color
|
||||
int ColorToInt(Color color)
|
||||
{
|
||||
return (((int)color.r << 24) | ((int)color.g << 16) | ((int)color.b << 8) | (int)color.a);
|
||||
}
|
||||
|
||||
// Returns color normalized as float [0..1]
|
||||
Vector4 ColorNormalize(Color color)
|
||||
{
|
||||
Vector4 result;
|
||||
|
||||
result.x = (float)color.r/255.0f;
|
||||
result.y = (float)color.g/255.0f;
|
||||
result.z = (float)color.b/255.0f;
|
||||
result.w = (float)color.a/255.0f;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Returns HSV values for a Color
|
||||
// NOTE: Hue is returned as degrees [0..360]
|
||||
Vector3 ColorToHSV(Color color)
|
||||
|
@ -745,8 +745,8 @@ RLAPI float GetFrameTime(void); // Returns tim
|
||||
RLAPI double GetTime(void); // Returns elapsed time in seconds since InitWindow()
|
||||
|
||||
// Color-related functions
|
||||
RLAPI float *ColorToFloat(Color color); // Returns normalized float array for a Color
|
||||
RLAPI int ColorToInt(Color color); // Returns hexadecimal value for a Color
|
||||
RLAPI Vector4 ColorNormalize(Color color); // Returns color normalized as float [0..1]
|
||||
RLAPI Vector3 ColorToHSV(Color color); // Returns HSV values for a Color
|
||||
RLAPI Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value
|
||||
RLAPI Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
|
||||
|
Loading…
Reference in New Issue
Block a user