-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathColor.cpp
44 lines (37 loc) · 941 Bytes
/
Color.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "Globals.h"
#include "Color.h"
#include "Interpolations.h"
void Color::LinearInterp(const Color& dest,float s)
{
a = LinearInterpolation(a,dest.a,s);
r = LinearInterpolation(r,dest.r,s);
g = LinearInterpolation(g,dest.g,s);
b = LinearInterpolation(b,dest.b,s);
}
void Color::CubicInterp(const Color& dest,float s)
{
a = CubicInterpolation(a,dest.a,s);
r = CubicInterpolation(r,dest.r,s);
g = CubicInterpolation(g,dest.g,s);
b = CubicInterpolation(b,dest.b,s);
}
void Color::CosInterp(const Color& dest,float s)
{
a = CosineInterpolation(a,dest.a,s);
r = CosineInterpolation(r,dest.r,s);
g = CosineInterpolation(g,dest.g,s);
b = CosineInterpolation(b,dest.b,s);
}
void Color::Brighten(float s)
{
LinearInterp(Color(a,1.0f,1.0f,1.0f),s);
}
void Color::Darken(float s)
{
LinearInterp(Color(a,0.0f,0.0f,0.0f),s);
}
void Color::Saturation(float s)
{
float v = (r + g + b) / 3.0f;
LinearInterp(Color(a,v,v,v),s);
}