Templates -- Meow
1.1.4
A C++ template which is unable and also not allowed to compile to obj-file first.
RGB.hpp
Go to the documentation of this file.
1
#include <algorithm>
2
#include <cstdint>
3
4
namespace
meow{
5
template
<
class
T>
inline
RGB<T>::RGB
(){ }
6
template
<
class
T>
inline
RGB<T>::RGB
(T
const
& r, T
const
& g, T
const
& b){
7
rgb_[0] = r; rgb_[1] = g; rgb_[2] = b;
8
}
9
template
<
class
T>
inline
RGB<T>::RGB
(T
const
* rgb){
10
for
(
int
i = 0; i < 3; i++){
11
rgb_[i] = rgb[i];
12
}
13
}
14
template
<
class
T>
inline
T
RGB<T>::r
()
const
{
return
rgb_[0]; }
15
template
<
class
T>
inline
T
RGB<T>::g
()
const
{
return
rgb_[1]; }
16
template
<
class
T>
inline
T
RGB<T>::b
()
const
{
return
rgb_[2]; }
17
template
<
class
T>
inline
T
RGB<T>::rgb
(
size_t
i)
const
{
18
return
rgb_[std::min((
size_t
)3 - 1, i)];
19
}
20
template
<
class
T>
inline
T
RGB<T>::bgr
(
size_t
i)
const
{
return
rgb(2 - i); }
22
template
<
class
T>
inline
T
RGB<T>::r
(T
const
& val){
return
(rgb_[0] = val); }
23
template
<
class
T>
inline
T
RGB<T>::g
(T
const
& val){
return
(rgb_[1] = val); }
24
template
<
class
T>
inline
T
RGB<T>::b
(T
const
& val){
return
(rgb_[2] = val); }
25
template
<
class
T>
inline
T
RGB<T>::rgb
(
size_t
i, T
const
& val){
26
i = std::min((
size_t
)3 - 1, i);
27
return
(rgb_[i] = val);
28
}
29
template
<
class
T>
inline
T
RGB<T>::bgr
(
size_t
i, T
const
& val){
30
return
rgb(2 - i, val);
31
}
32
33
34
35
inline
RGBf::RGBf
():
RGB
(0.0, 0.0, 0.0){ }
36
inline
RGBf::~RGBf
(){ }
37
inline
RGBf::RGBf
(
double
const
&r,
double
const
&g,
double
const
&b):
RGB
(r,g,b){}
38
inline
RGBf::RGBf
(
double
const
* rgb):
RGB
(rgb){ }
39
inline
double
RGBf::rMin
()
const
{
return
0.0; }
40
inline
double
RGBf::rMax
()
const
{
return
1.0; }
41
inline
double
RGBf::gMin
()
const
{
return
0.0; }
42
inline
double
RGBf::gMax
()
const
{
return
1.0; }
43
inline
double
RGBf::bMin
()
const
{
return
0.0; }
44
inline
double
RGBf::bMax
()
const
{
return
1.0; }
45
46
47
48
49
inline
RGBi::RGBi
():
RGB
(0.0, 0.0, 0.0){ }
50
inline
RGBi::~RGBi
(){ }
51
inline
RGBi::RGBi
(
int32_t
const
&r,
int32_t
const
&g,
int32_t
const
&b):
RGB
(r,g,b){}
52
inline
RGBi::RGBi
(
int32_t
const
* rgb):
RGB
(rgb){ }
53
inline
int32_t
RGBi::rMin
()
const
{
return
0; }
54
inline
int32_t
RGBi::rMax
()
const
{
return
255; }
55
inline
int32_t
RGBi::gMin
()
const
{
return
0; }
56
inline
int32_t
RGBi::gMax
()
const
{
return
255; }
57
inline
int32_t
RGBi::bMin
()
const
{
return
0; }
58
inline
int32_t
RGBi::bMax
()
const
{
return
255; }
59
}
meow::RGBf::gMax
double gMax() const
Definition:
RGB.hpp:42
meow::RGBf::RGBf
RGBf()
Definition:
RGB.hpp:35
meow::RGBf::gMin
double gMin() const
Definition:
RGB.hpp:41
meow::RGBf::rMax
double rMax() const
Definition:
RGB.hpp:40
meow::RGBi::bMin
int32_t bMin() const
Definition:
RGB.hpp:57
meow::RGB
Definition:
RGB.h:5
meow::RGBf::bMin
double bMin() const
Definition:
RGB.hpp:43
meow::RGBi::rMin
int32_t rMin() const
Definition:
RGB.hpp:53
meow::RGB::r
T r() const
Definition:
RGB.hpp:14
meow::RGBf::rMin
double rMin() const
Definition:
RGB.hpp:39
meow::RGBi::RGBi
RGBi()
Definition:
RGB.hpp:49
meow::RGBf::bMax
double bMax() const
Definition:
RGB.hpp:44
meow::RGB::RGB
RGB()
Definition:
RGB.hpp:5
int32_t
meow::RGBf::~RGBf
~RGBf()
Definition:
RGB.hpp:36
meow::RGBi::gMax
int32_t gMax() const
Definition:
RGB.hpp:56
meow::RGBi::~RGBi
~RGBi()
Definition:
RGB.hpp:50
meow::RGB::g
T g() const
Definition:
RGB.hpp:15
meow::RGB::b
T b() const
Definition:
RGB.hpp:16
meow::RGB::bgr
T bgr(size_t i) const
Definition:
RGB.hpp:20
meow::RGB::rgb
T rgb(size_t i) const
Definition:
RGB.hpp:17
meow::RGBi::gMin
int32_t gMin() const
Definition:
RGB.hpp:55
meow::RGBi::bMax
int32_t bMax() const
Definition:
RGB.hpp:58
meow::RGBi::rMax
int32_t rMax() const
Definition:
RGB.hpp:54
meowpp
colors
RGB.hpp
Generated on Mon Jun 23 2014 17:02:02 for Templates -- Meow by
1.8.6