13 #ifndef _CS237_COLOR_HXX_
14 #define _CS237_COLOR_HXX_
17 #error "c237-color.hxx should not be included directly"
23 unsigned char r,
g,
b;
28 explicit color3ub (
unsigned char grey) : r(grey), g(grey), b(grey) { }
29 color3ub (
unsigned char rr,
unsigned char gg,
unsigned char bb) : r(rr), g(gg), b(bb) { }
31 unsigned char &
operator[] (
unsigned int const &i);
32 unsigned char const &
operator[] (
unsigned int const &i)
const;
43 explicit color4ub (
color3ub const &c,
unsigned char alpha) : r(c.r), g(c.g), b(c.b), a(alpha) { }
45 explicit color4ub (
unsigned char grey) : r(grey), g(grey), b(grey), a(255) { }
46 explicit color4ub (
unsigned char rr,
unsigned char gg,
unsigned char bb) : r(rr), g(gg), b(bb), a(255) { }
47 color4ub (
unsigned char rr,
unsigned char gg,
unsigned char bb,
unsigned char aa)
48 : r(rr), g(gg), b(bb), a(aa)
51 unsigned char &
operator[] (
unsigned int const &i);
52 unsigned char const &
operator[] (
unsigned int const &i)
const;
60 color3f () : r(0.0f), g(0.0f), b(0.0f) { }
63 explicit color3f (
float grey) : r(grey), g(grey), b(grey) { }
64 color3f (
float rr,
float gg,
float bb) : r(rr), g(gg), b(bb) { }
67 float const &
operator[] (
unsigned int const &i)
const;
86 color4f () : r(0.0f), g(0.0f), b(0.0f), a(1.0f) { }
88 explicit color4f (
color3f const &c,
float alpha) : r(c.r), g(c.g), b(c.b), a(alpha) { }
91 explicit color4f (
float grey) : r(grey), g(grey), b(grey), a(1.0f) { }
92 explicit color4f (
float rr,
float gg,
float bb) : r(rr), g(gg), b(bb), a(1.0f) { }
93 color4f (
float rr,
float gg,
float bb,
float aa) : r(rr), g(gg), b(bb), a(aa) { }
96 float const &
operator[] (
unsigned int const &i)
const;
115 std::ostream&
operator<< (std::ostream& s, color3ub
const &c);
120 std::ostream&
operator<< (std::ostream& s, color4ub
const &c);
125 std::ostream&
operator<< (std::ostream& s, color3f
const &c);
130 std::ostream&
operator<< (std::ostream& s, color4f
const &c);
float & operator[](unsigned int const &i)
Definition: cs237-color.inl:108
float a
Definition: cs237-color.hxx:84
color4f(float rr, float gg, float bb, float aa)
Definition: cs237-color.hxx:93
color4f(float rr, float gg, float bb)
Definition: cs237-color.hxx:92
color4f & operator+=(float const &s)
Definition: cs237-color.inl:209
color3ub & operator=(color3f const &c)
Definition: cs237-color.inl:67
unsigned char g
Definition: cs237-color.hxx:23
float r
Definition: cs237-color.hxx:58
color3f & operator+=(float const &s)
Definition: cs237-color.inl:128
color4ub(color3ub const &c)
Definition: cs237-color.hxx:42
color4f & operator-=(float const &s)
Definition: cs237-color.inl:226
color4ub(unsigned char grey)
Definition: cs237-color.hxx:45
color4ub()
Definition: cs237-color.hxx:40
unsigned char & operator[](unsigned int const &i)
Definition: cs237-color.inl:56
color4f(color3f const &c, float alpha)
Definition: cs237-color.hxx:88
float g
Definition: cs237-color.hxx:84
color4f()
Definition: cs237-color.hxx:86
color4ub(color4ub const &c)
Definition: cs237-color.hxx:41
color3f & operator=(color3ub const &c)
convert a color3ub value to a color3f l-value
Definition: cs237-color.inl:120
unsigned char & operator[](unsigned int const &i)
Definition: cs237-color.inl:81
float b
Definition: cs237-color.hxx:84
Definition: cs237-color.hxx:83
color3ub(unsigned char rr, unsigned char gg, unsigned char bb)
Definition: cs237-color.hxx:29
color3f & operator*=(float const &s)
Definition: cs237-color.inl:158
color4f(float grey)
Definition: cs237-color.hxx:91
Definition: cs237-color.hxx:22
Definition: cs237-color.hxx:37
color4ub & operator=(color4f const &c)
Definition: cs237-color.inl:92
unsigned char b
Definition: cs237-color.hxx:38
float r
Definition: cs237-color.hxx:84
color4ub(unsigned char rr, unsigned char gg, unsigned char bb, unsigned char aa)
Definition: cs237-color.hxx:47
float b
Definition: cs237-color.hxx:58
unsigned char g
Definition: cs237-color.hxx:38
unsigned char r
Definition: cs237-color.hxx:38
color3f(float grey)
Definition: cs237-color.hxx:63
color3f(float rr, float gg, float bb)
Definition: cs237-color.hxx:64
color3f & clamp()
Definition: cs237-color.inl:173
color4f & operator=(color4ub const &c)
convert a color4ub value to a color4f l-value
Definition: cs237-color.inl:200
color3f(color3f const &c)
Definition: cs237-color.hxx:61
color3ub()
Definition: cs237-color.hxx:25
float g
Definition: cs237-color.hxx:58
Definition: cs237-aabb.hxx:18
color3f & operator-=(float const &s)
Definition: cs237-color.inl:143
unsigned char r
Definition: cs237-color.hxx:23
color3ub(color3ub const &c)
Definition: cs237-color.hxx:26
color4ub(color3ub const &c, unsigned char alpha)
Definition: cs237-color.hxx:43
float & operator[](unsigned int const &i)
Definition: cs237-color.inl:188
color4f(color3f const &c)
Definition: cs237-color.hxx:87
color4f(color4f const &c)
Definition: cs237-color.hxx:89
Definition: cs237-color.hxx:57
unsigned char a
Definition: cs237-color.hxx:38
color4f & clamp()
Definition: cs237-color.inl:260
color3ub(unsigned char grey)
Definition: cs237-color.hxx:28
color4f & operator*=(float const &s)
Definition: cs237-color.inl:243
color3f()
Definition: cs237-color.hxx:60
unsigned char b
Definition: cs237-color.hxx:23
color4ub(unsigned char rr, unsigned char gg, unsigned char bb)
Definition: cs237-color.hxx:46
std::ostream & operator<<(std::ostream &s, color3ub const &c)
output the color to a stream