Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/util/color.h @ 8145

Last change on this file since 8145 was 8145, checked in by bensch, 18 years ago

trunk: merged the gui back
merged with command:
svn merge -r8114:HEAD https://svn.orxonox.net/orxonox/branches/gui .
→ no conflicts

File size: 1.2 KB
Line 
1/*!
2 * @file color.h
3 * @brief Definition of color-calculations
4 *
5 * code borrowed from:
6 * http://www.easyrgb.com/math.php
7*/
8
9#ifndef _COLOR_H
10#define _COLOR_H
11
12#include "vector.h"
13
14//! a very abstract Class that helps transforming Colors into different Systems
15class Color
16{
17public:
18  Color(float r, float g, float b, float a) :_r(r), _g(g), _b(b), _a(a) {};
19  Color(const Color& c) { _r = c._r; _g = c._g; _b = c._b; _a = c._a; };
20
21  float r() const { return _r; }
22  float& r() { return _r; }
23  float g() const { return _g; }
24  float& g() { return _g; }
25  float b() const { return _b; }
26  float& b() { return _b; }
27  float a() const { return _a; }
28  float& a() { return _a; }
29
30public:
31  static Vector RGBtoHSV (const Vector& RGB);
32  static void RGBtoHSV (const Vector& RGB, Vector& HSV);
33  static Vector HSVtoRGB (const Vector& HSV);
34  static void HSVtoRGB (const Vector& HSV, Vector& RGB);
35
36private:
37  static float minrgb(float r, float g, float b);
38  static float maxrgb(float r, float g, float b);
39
40  float       _r;     //!< Red Value.
41  float       _g;     //!< Green Value.
42  float       _b;     //!< Blue Value.
43  float       _a;     //!< Alpha Value.
44
45};
46
47#endif /* _COLOR_H */
Note: See TracBrowser for help on using the repository browser.