projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactored video/ subsystem to make adding other methods of rendering (in particular...
[supertux.git]
/
src
/
video
/
color.hpp
diff --git
a/src/video/color.hpp
b/src/video/color.hpp
index
e94b362
..
e3ff678
100644
(file)
--- a/
src/video/color.hpp
+++ b/
src/video/color.hpp
@@
-66,6
+66,16
@@
public:
log_warning << "color value out of range: " << red << ", " << green << ", " << blue << ", " << alpha << std::endl;
}
log_warning << "color value out of range: " << red << ", " << green << ", " << blue << ", " << alpha << std::endl;
}
+ float greyscale() const
+ {
+ return red * 0.30 + green * 0.59 + blue * 0.11;
+ }
+
+ bool operator < (const Color& other) const
+ {
+ return greyscale() < other.greyscale();
+ }
+
float red, green, blue, alpha;
};
float red, green, blue, alpha;
};