renamed MixColors to ColorLerp (https://github.com/raysan5/raylib/pull/4310#issuecomment-2340121038)
This commit is contained in:
parent
4e7887a7fc
commit
b2ca734fd1
|
|
@ -1425,7 +1425,7 @@ RLAPI int ColorToInt(Color color); // G
|
|||
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 Vector3 ColorToHSV(Color color); // Get HSV values for a Color, hue [0..360], saturation/value [0..1]
|
||||
RLAPI Color MixColors(Color color1, Color color2, float t); // Mix 2 Colors together
|
||||
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 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
|
||||
|
|
|
|||
|
|
@ -4987,24 +4987,24 @@ Vector3 ColorToHSV(Color color)
|
|||
|
||||
/*
|
||||
Mix 2 Colors togehter.
|
||||
t = what color is more dominant.
|
||||
t=0.0f means color 1 is more dominant
|
||||
t=1.0f means color 2 is more dominant
|
||||
set t to 0.5 to have both colors balanced
|
||||
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 MixColors(Color color1, Color color2, float t) {
|
||||
Color newColor = { 0, 0, 0, 0 };
|
||||
if (t < 0) {t=0.0f;}
|
||||
else if(t>1) {t=1.0f;}
|
||||
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-t) * color1.r + t * color2.r);
|
||||
newColor.g = (unsigned char)((1.0f-t) * color1.g + t * color2.g);
|
||||
newColor.b = (unsigned char)((1.0f-t) * color1.b + t * color2.b);
|
||||
newColor.a = (unsigned char)((1.0f-t) * color1.a + t * color2.a);
|
||||
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
|
||||
// Implementation reference: https://en.wikipedia.org/wiki/HSL_and_HSV#Alternative_HSV_conversion
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user