iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PixRGBImpl.H
Go to the documentation of this file.
1 /*! @file
2  @author Randolph Voorhies
3  @copyright GNU Public License (GPL v3)
4  @section License
5  @verbatim
6  // ////////////////////////////////////////////////////////////////////////
7  // The iLab Neuromorphic Robotics Toolkit (NRT) //
8  // Copyright 2010-2012 by the University of Southern California (USC) //
9  // and the iLab at USC. //
10  // //
11  // iLab - University of Southern California //
12  // Hedco Neurociences Building, Room HNB-10 //
13  // Los Angeles, Ca 90089-2520 - USA //
14  // //
15  // See http://ilab.usc.edu for information about this project. //
16  // ////////////////////////////////////////////////////////////////////////
17  // This file is part of The iLab Neuromorphic Robotics Toolkit. //
18  // //
19  // The iLab Neuromorphic Robotics Toolkit is free software: you can //
20  // redistribute it and/or modify it under the terms of the GNU General //
21  // Public License as published by the Free Software Foundation, either //
22  // version 3 of the License, or (at your option) any later version. //
23  // //
24  // The iLab Neuromorphic Robotics Toolkit is distributed in the hope //
25  // that it will be useful, but WITHOUT ANY WARRANTY; without even the //
26  // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
27  // PURPOSE. See the GNU General Public License for more details. //
28  // //
29  // You should have received a copy of the GNU General Public License //
30  // along with The iLab Neuromorphic Robotics Toolkit. If not, see //
31  // <http://www.gnu.org/licenses/>. //
32  // ////////////////////////////////////////////////////////////////////////
33  @endverbatim */
34 
35 
36 // ######################################################################
37 template <class T>
38 PixRGB<T>::PixRGB() : PixelBase<T, 3, nrt::PixRGB>()
39 { }
40 
41 // ######################################################################
42 template <class T>
43 PixRGB<T>::PixRGB(T r, T g, T b)
44 {
45  this->channels[0] = r;
46  this->channels[1] = g;
47  this->channels[2] = b;
48 }
49 
50 // ######################################################################
51 template<class T>
52 template<class T2>
53 PixRGB<T>::PixRGB(PixRGB<T2> const& other) :
54  PixelBase<T, 3, nrt::PixRGB>(other)
55 { }
56 
57 // ######################################################################
58 template <class T>
59 template <typename T1>
60 PixRGB<T>::PixRGB(T1 value) :
61  PixelBase<T, 3, nrt::PixRGB>(value)
62 { }
63 
64 // ######################################################################
65 template <class T>
66 template <class rType, class gType, class bType>
67 PixRGB<T>::PixRGB(rType r, gType g, bType b)
68 {
69  this->channels[0] = clamped_convert<T>(r);
70  this->channels[1] = clamped_convert<T>(g);
71  this->channels[2] = clamped_convert<T>(b);
72 }
73 
74 // ######################################################################
75 template <class T>
76 T PixRGB<T>::r() const
77 { return this->channels[0]; }
78 
79 // ######################################################################
80 template <class T>
81 T PixRGB<T>::g() const
82 { return this->channels[1]; }
83 
84 // ######################################################################
85 template <class T>
86 T PixRGB<T>::b() const
87 { return this->channels[2]; }
88 
89 // ######################################################################
90 template <class T>
91 void PixRGB<T>::setR(T value)
92 { this->channels[0] = value; }
93 
94 // ######################################################################
95 template <class T>
96 void PixRGB<T>::setG(T value)
97 { this->channels[1] = value; }
98 
99 // ######################################################################
100 template <class T>
101 void PixRGB<T>::setB(T value)
102 { this->channels[2] = value; }
103 
104 // ######################################################################
105 template <class T>
106 template<class T2>
107 void PixRGB<T>::setR(T2 value)
108 { this->channels[0] = clamped_convert<T>(value); }
109 
110 // ######################################################################
111 template <class T>
112 template<class T2>
113 void PixRGB<T>::setG(T2 value)
114 { this->channels[1] = clamped_convert<T>(value); }
115 
116 // ######################################################################
117 template <class T>
118 template<class T2>
119 void PixRGB<T>::setB(T2 value)
120 { this->channels[2] = clamped_convert<T>(value); }
121 
122 // ######################################################################
123 template <class T>
125 { return *this; }
126 
127 // ######################################################################
128 template <class T>
130 { return rgb; }