color.hpp
Go to the documentation of this file.
1 
17 #ifndef COLOR_HPP
18 #define COLOR_HPP
19 
20 #include <string>
21 
22 namespace cpe
23 {
24 
26 typedef unsigned char octet;
27 
32 class color
33 {
34 public:
35 
36  // ********************************************* //
37  // ********************************************* //
38  // CONSTRUCTORS
39  // ********************************************* //
40  // ********************************************* //
41 
43  color();
47  color(int r,int g,int b);
48 
49 
50 
51  // ********************************************* //
52  // ********************************************* //
53  // GET/SET
54  // ********************************************* //
55  // ********************************************* //
56 
58  int red() const;
60  int green() const;
62  int blue() const;
63 
65  octet& red();
67  octet& green();
69  octet& blue();
70 
71  // ********************************************* //
72  // ********************************************* //
73  // COMPUTATION
74  // ********************************************* //
75  // ********************************************* //
76 
81  static double norm(const color& c1,const color& c2);
82 
83 
84  // ********************************************* //
85  // ********************************************* //
86  // Conversion
87  // ********************************************* //
88  // ********************************************* //
89 
91  std::string to_string() const;
92 
93 private:
94 
101 };
102 
104 std::ostream& operator<<(std::ostream& stream,const color& c);
105 }
106 
107 #endif