add ColorFromInt for convenance

This commit is contained in:
Danil 2023-11-22 22:16:01 +02:00 committed by GitHub
parent a3a73b9332
commit f2d351f269
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -1401,6 +1401,7 @@ RLAPI void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle
// Color/pixel related functions // Color/pixel related functions
RLAPI Color Fade(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f RLAPI Color Fade(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f
RLAPI int ColorToInt(Color color); // Get hexadecimal value for a Color RLAPI int ColorToInt(Color color); // Get hexadecimal value for a Color
RLAPI Color ColorFromInt(unsigned int hexValue); // Get Color structure from hexadecimal value
RLAPI Vector4 ColorNormalize(Color color); // Get Color normalized as float [0..1] RLAPI Vector4 ColorNormalize(Color color); // Get Color normalized as float [0..1]
RLAPI Color ColorFromNormalized(Vector4 normalized); // Get Color from normalized values [0..1] RLAPI Color ColorFromNormalized(Vector4 normalized); // Get Color from normalized values [0..1]
RLAPI Vector3 ColorToHSV(Color color); // Get HSV values for a Color, hue [0..360], saturation/value [0..1] RLAPI Vector3 ColorToHSV(Color color); // Get HSV values for a Color, hue [0..360], saturation/value [0..1]

View File

@ -4437,6 +4437,12 @@ int ColorToInt(Color color)
return (((int)color.r << 24) | ((int)color.g << 16) | ((int)color.b << 8) | (int)color.a); return (((int)color.r << 24) | ((int)color.g << 16) | ((int)color.b << 8) | (int)color.a);
} }
// Get Color structure from hexadecimal value
Color ColorFromInt(unsigned int hexValue)
{
return GetColor(hexValue);
}
// Get color normalized as float [0..1] // Get color normalized as float [0..1]
Vector4 ColorNormalize(Color color) Vector4 ColorNormalize(Color color)
{ {