forked from satu0king/ImageProcessing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColor.cpp
More file actions
26 lines (22 loc) · 724 Bytes
/
Color.cpp
File metadata and controls
26 lines (22 loc) · 724 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
#include <iostream>
using namespace std;
#include "Color.h"
Color operator*(float alpha, const Color c1) {
return Color(c1._red * alpha, c1._green * alpha, c1._blue * alpha);
}
Color operator+(const Color &c2, const Color &c1) {
return Color(c1._red + c2._red, c1._green + c2._green, c1._blue + c2._blue);
}
bool operator==(const Color &c2, const Color &c1) {
return c1._red == c2._red && c1._green == c2._green && c1._blue == c2._blue;
}
Color::Color(Color const &c) {
_red = c._red;
_blue = c._blue;
_green = c._green;
};
int Color::brightness() { return (_red + _green + _blue) / 3; }
ostream &operator<<(ostream &os, Color const &c) {
os << c._red << " " << c._green << " " << c._blue;
return os;
};