diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2014-04-08 05:17:27 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2014-04-08 05:17:27 +0200 |
commit | ac164afa0954e28b521dc6b19d2ccf0320cc8ed1 (patch) | |
tree | 576420091adcad7b91dc1c8b296cc36b3d827b74 /src/utils/color/rgb.hpp | |
parent | 196f41688d01b7f0a79567c617fd6dd3171150ff (diff) | |
download | usdx-ac164afa0954e28b521dc6b19d2ccf0320cc8ed1.tar.gz usdx-ac164afa0954e28b521dc6b19d2ccf0320cc8ed1.tar.xz usdx-ac164afa0954e28b521dc6b19d2ccf0320cc8ed1.zip |
utils/colors: move colors into subdir, add hsv
All color classes are now in an own subdirectory with a short name.
The new class HsvColor represents the Hue/Saturation/Value color model and
comes with conversion functions to and from rgb colors (currently integer
arithmetic without optimization for higher presicion).
Diffstat (limited to '')
-rw-r--r-- | src/utils/color/rgb.hpp (renamed from src/utils/rgb_color.hpp) | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/utils/rgb_color.hpp b/src/utils/color/rgb.hpp index 36a5b42c..6871e452 100644 --- a/src/utils/rgb_color.hpp +++ b/src/utils/color/rgb.hpp @@ -26,33 +26,41 @@ #define RGB_COLOR_HPP #include <GL/gl.h> +#include <stdint.h> namespace usdx { + class HsvColor; + class RgbColor { private: - float red; - float green; - float blue; + uint8_t red; + uint8_t green; + uint8_t blue; protected: mutable GLubyte *array; mutable size_t array_length; public: - RgbColor(int red, int green, int blue); - RgbColor(float red, float green, float blue); + RgbColor(uint8_t red, uint8_t green, uint8_t blue); + RgbColor(const uint32_t color); RgbColor(const RgbColor& color); + RgbColor(const HsvColor& hsv); virtual ~RgbColor(); RgbColor& operator=(const RgbColor& color); - float get_red(void) const; - float get_green(void) const; - float get_blue(void) const; + uint8_t get_red(void) const; + uint8_t get_green(void) const; + uint8_t get_blue(void) const; virtual const GLubyte* get_array(size_t len) const; int get_array_comonent_count(void) const; + + bool is_grey(void) const; + bool is_black(void) const; + bool is_white(void) const; }; }; |