-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColor.cpp
More file actions
44 lines (35 loc) · 825 Bytes
/
Copy pathColor.cpp
File metadata and controls
44 lines (35 loc) · 825 Bytes
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 "Color.h"
#include <algorithm>
double Standardize(double x) {
return std::min(Color::MaxValue, std::max(static_cast<double>(0), x));
}
Color::Color() {
blue_ = 0;
green_ = 0;
red_ = 0;
}
Color::Color(double blue, double green, double red) {
blue_ = blue;
green_ = green;
red_ = red;
}
double Color::GetBlue() const {
return blue_;
}
double Color::GetGreen() const {
return green_;
}
double Color::GetRed() const {
return red_;
}
void Color::MakeNegative() {
blue_ = MaxValue - blue_;
green_ = MaxValue - green_;
red_ = MaxValue - red_;
}
void Color::MakeMonotone(double blue_coef, double green_coef, double red_coef) {
double value = blue_ * blue_coef + green_ * green_coef + red_ * red_coef;
blue_ = value;
green_ = value;
red_ = value;
}