changed ColorLerp to be more like other functions
This commit is contained in:
parent
1238af20f0
commit
113f3ea58b
|
|
@ -1425,7 +1425,6 @@ RLAPI int ColorToInt(Color color); // G
|
||||||
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]
|
||||||
RLAPI Color ColorLerp(Color color1, Color color2, float d); // Mix 2 Colors together
|
|
||||||
RLAPI Color ColorFromHSV(float hue, float saturation, float value); // Get a Color from HSV values, hue [0..360], saturation/value [0..1]
|
RLAPI Color ColorFromHSV(float hue, float saturation, float value); // Get a Color from HSV values, hue [0..360], saturation/value [0..1]
|
||||||
RLAPI Color ColorTint(Color color, Color tint); // Get color multiplied with another color
|
RLAPI Color ColorTint(Color color, Color tint); // Get color multiplied with another color
|
||||||
RLAPI Color ColorBrightness(Color color, float factor); // Get color with brightness correction, brightness factor goes from -1.0f to 1.0f
|
RLAPI Color ColorBrightness(Color color, float factor); // Get color with brightness correction, brightness factor goes from -1.0f to 1.0f
|
||||||
|
|
@ -1436,6 +1435,7 @@ RLAPI Color GetColor(unsigned int hexValue); // G
|
||||||
RLAPI Color GetPixelColor(void *srcPtr, int format); // Get Color from a source pixel pointer of certain format
|
RLAPI Color GetPixelColor(void *srcPtr, int format); // Get Color from a source pixel pointer of certain format
|
||||||
RLAPI void SetPixelColor(void *dstPtr, Color color, int format); // Set color formatted into destination pixel pointer
|
RLAPI void SetPixelColor(void *dstPtr, Color color, int format); // Set color formatted into destination pixel pointer
|
||||||
RLAPI int GetPixelDataSize(int width, int height, int format); // Get pixel data size in bytes for certain format
|
RLAPI int GetPixelDataSize(int width, int height, int format); // Get pixel data size in bytes for certain format
|
||||||
|
RLAPI Color ColorLerp(Color color1, Color color2, float d); // Mix 2 Colors Together
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Font Loading and Text Drawing Functions (Module: text)
|
// Font Loading and Text Drawing Functions (Module: text)
|
||||||
|
|
|
||||||
|
|
@ -4985,25 +4985,6 @@ Vector3 ColorToHSV(Color color)
|
||||||
return hsv;
|
return hsv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Mix 2 Colors togehter.
|
|
||||||
d = what color is more dominant.
|
|
||||||
d=0.0f means color 1 is more dominant
|
|
||||||
d=1.0f means color 2 is more dominant
|
|
||||||
set d to 0.5 to have both colors balanced
|
|
||||||
*/
|
|
||||||
Color ColorLerp(Color color1, Color color2, float d) {
|
|
||||||
Color newColor = { 0, 0, 0, 0};
|
|
||||||
if (d < 0) {d=0.0f;}
|
|
||||||
else if(d>1) {d=1.0f;}
|
|
||||||
|
|
||||||
newColor.r = (unsigned char)((1.0f-d) * color1.r + d * color2.r);
|
|
||||||
newColor.g = (unsigned char)((1.0f-d) * color1.g + d * color2.g);
|
|
||||||
newColor.b = (unsigned char)((1.0f-d) * color1.b + d * color2.b);
|
|
||||||
newColor.a = (unsigned char)((1.0f-d) * color1.a + d * color2.a);
|
|
||||||
|
|
||||||
return newColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Get a Color from HSV values
|
// Get a Color from HSV values
|
||||||
|
|
@ -5443,6 +5424,24 @@ int GetPixelDataSize(int width, int height, int format)
|
||||||
return dataSize;
|
return dataSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Mix 2 Colors togehter.
|
||||||
|
// d = dominance. 0.5 for equal
|
||||||
|
Color ColorLerp(Color color1, Color color2, float d)
|
||||||
|
{
|
||||||
|
Color newColor = { 0, 0, 0, 0 };
|
||||||
|
if (d < 0) {d=0.0f;}
|
||||||
|
else if(d>1) {d=1.0f;}
|
||||||
|
|
||||||
|
newColor.r = (unsigned char)((1.0f-d) * color1.r + d * color2.r);
|
||||||
|
newColor.g = (unsigned char)((1.0f-d) * color1.g + d * color2.g);
|
||||||
|
newColor.b = (unsigned char)((1.0f-d) * color1.b + d * color2.b);
|
||||||
|
newColor.a = (unsigned char)((1.0f-d) * color1.a + d * color2.a);
|
||||||
|
|
||||||
|
return newColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module specific Functions Definition
|
// Module specific Functions Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user