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
RevLine 
[4838]1/*!
[5009]2 * @file color.h
3 * @brief Definition of color-calculations
4 *
5 * code borrowed from:
6 * http://www.easyrgb.com/math.php
[3245]7*/
[1853]8
[5009]9#ifndef _COLOR_H
10#define _COLOR_H
[1853]11
[7195]12#include "vector.h"
[1853]13
[5011]14//! a very abstract Class that helps transforming Colors into different Systems
[5009]15class Color
16{
[7195]17public:
[8145]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:
[5010]31  static Vector RGBtoHSV (const Vector& RGB);
[7195]32  static void RGBtoHSV (const Vector& RGB, Vector& HSV);
[5010]33  static Vector HSVtoRGB (const Vector& HSV);
[7195]34  static void HSVtoRGB (const Vector& HSV, Vector& RGB);
[5010]35
[7195]36private:
[5010]37  static float minrgb(float r, float g, float b);
38  static float maxrgb(float r, float g, float b);
[8145]39
40  float       _r;     //!< Red Value.
41  float       _g;     //!< Green Value.
42  float       _b;     //!< Blue Value.
43  float       _a;     //!< Alpha Value.
44
[1853]45};
46
[5009]47#endif /* _COLOR_H */
Note: See TracBrowser for help on using the repository browser.