cartobase  5.0.5
voxelrgba_decl.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 #ifndef CARTOBASE_TYPE_RGBA_DECL_H
35 #define CARTOBASE_TYPE_RGBA_DECL_H
36 //--- cartobase --------------------------------------------------------------
37 #include <cartobase/type/types.h>
39 //----------------------------------------------------------------------------
40 
41 /*****************************************************************************
42  * Even though declarations are here, this is NOT the file you want to
43  * include to use VoxelRGBA.
44  * Since all methods are inline and for readability issues, declarations
45  * are contained in "_decl.h" file and definitions in "_def.h" file.
46  * You should include ".h" file which binds all necessary headers.
47  ****************************************************************************/
48 
49 namespace carto {
50 
51  class VoxelRGBA;
52  class VoxelRGB;
53 
54  template<> inline std::string DataTypeCode<VoxelRGBA>::dataType()
55  {
56  return "RGBA";
57  }
58 
71  class VoxelRGBA : public VoxelValue<uint8_t,4>
72  {
73  public:
74  //=== TYPES =====================================================
75  typedef uint8_t ChannelType;
76 
77  //=== CONSTRUCTORS =====================================================
78  VoxelRGBA( const VoxelRGBA &other );
79  VoxelRGBA( const VoxelRGB &other);
80  VoxelRGBA( const VoxelValue<uint8_t,4> &other );
81  VoxelRGBA( const uint8_t &r = 0, const uint8_t &g = 0,
82  const uint8_t &b = 0, const uint8_t &a = 0 );
83  ~VoxelRGBA();
84 
85  //=== AFFECTATION ======================================================
86  VoxelRGBA & operator = ( const VoxelRGBA & other );
87  VoxelRGBA & operator = ( const VoxelRGB & other );
88  VoxelRGBA & operator = ( const uint8_t & value );
89 
90  //=== OPERATORS ========================================================
91  VoxelRGBA & operator += ( const VoxelRGBA & other );
92  VoxelRGBA & operator += ( const VoxelRGB & other );
93  VoxelRGBA & operator -= ( const VoxelRGBA & other );
94  VoxelRGBA & operator -= ( const VoxelRGB & other );
95  VoxelRGBA & operator += ( const uint8_t & value );
96  VoxelRGBA & operator -= ( const uint8_t & value );
97  VoxelRGBA & operator *= ( const uint8_t & value );
98  VoxelRGBA & operator *= ( const uint16_t & value );
99  VoxelRGBA & operator *= ( const uint32_t & value );
100  VoxelRGBA & operator *= ( const uint64_t & value );
101  VoxelRGBA & operator *= ( const float & value );
102  VoxelRGBA & operator *= ( const double & value );
103  VoxelRGBA & operator /= ( const uint8_t & value );
104  VoxelRGBA & operator /= ( const uint16_t & value );
105  VoxelRGBA & operator /= ( const uint32_t & value );
106  VoxelRGBA & operator /= ( const uint64_t & value );
107  VoxelRGBA & operator /= ( const float & value );
108  VoxelRGBA & operator /= ( const double & value );
109  // long int are still used in volumes
110  VoxelRGBA & operator *= ( const long & value );
111  VoxelRGBA & operator /= ( const long & value );
112 
113  //=== ACCESSORS ========================================================
114  inline const uint8_t& red () const { return (*this)[0]; }
115  inline const uint8_t& green () const { return (*this)[1]; }
116  inline const uint8_t& blue () const { return (*this)[2]; }
117  inline const uint8_t& alpha () const { return (*this)[3]; }
118  inline uint8_t& red () { return (*this)[0]; }
119  inline uint8_t& green () { return (*this)[1]; }
120  inline uint8_t& blue () { return (*this)[2]; }
121  inline uint8_t& alpha () { return (*this)[3]; }
122  };
123 
124  VoxelRGBA operator + (const VoxelRGBA &aa, const VoxelRGBA &bb);
125  VoxelRGBA operator + (const VoxelRGBA &aa, const uint8_t &bb);
126  VoxelRGBA operator + (const VoxelRGBA &aa, const uint16_t &bb);
127  VoxelRGBA operator + (const VoxelRGBA &aa, const uint32_t &bb);
128  VoxelRGBA operator + (const VoxelRGBA &aa, const uint64_t &bb);
129  VoxelRGBA operator + (const VoxelRGBA &aa, const float &bb);
130  VoxelRGBA operator + (const VoxelRGBA &aa, const double &bb);
131  VoxelRGBA operator + (const uint8_t &aa, const VoxelRGBA &bb);
132  VoxelRGBA operator + (const uint16_t &aa, const VoxelRGBA &bb);
133  VoxelRGBA operator + (const uint32_t &aa, const VoxelRGBA &bb);
134  VoxelRGBA operator + (const uint64_t &aa, const VoxelRGBA &bb);
135  VoxelRGBA operator + (const float &aa, const VoxelRGBA &bb);
136  VoxelRGBA operator + (const double &aa, const VoxelRGBA &bb);
137  VoxelRGBA operator - (const VoxelRGBA &aa, const VoxelRGBA &bb);
138  VoxelRGBA operator - (const VoxelRGBA &aa, const uint8_t &bb);
139  VoxelRGBA operator - (const VoxelRGBA &aa, const uint16_t &bb);
140  VoxelRGBA operator - (const VoxelRGBA &aa, const uint32_t &bb);
141  VoxelRGBA operator - (const VoxelRGBA &aa, const uint64_t &bb);
142  VoxelRGBA operator - (const VoxelRGBA &aa, const float &bb);
143  VoxelRGBA operator - (const VoxelRGBA &aa, const double &bb);
144  VoxelRGBA operator - (const uint8_t &aa, const VoxelRGBA &bb);
145  VoxelRGBA operator - (const uint16_t &aa, const VoxelRGBA &bb);
146  VoxelRGBA operator - (const uint32_t &aa, const VoxelRGBA &bb);
147  VoxelRGBA operator - (const uint64_t &aa, const VoxelRGBA &bb);
148  VoxelRGBA operator - (const float &aa, const VoxelRGBA &bb);
149  VoxelRGBA operator - (const double &aa, const VoxelRGBA &bb);
150  VoxelRGBA operator * (const VoxelRGBA &aa, const uint8_t &bb);
151  VoxelRGBA operator * (const VoxelRGBA &aa, const uint16_t &bb);
152  VoxelRGBA operator * (const VoxelRGBA &aa, const uint32_t &bb);
153  VoxelRGBA operator * (const VoxelRGBA &aa, const uint64_t &bb);
154  VoxelRGBA operator * (const VoxelRGBA &aa, const float &bb);
155  VoxelRGBA operator * (const VoxelRGBA &aa, const double &bb);
156  VoxelRGBA operator * (const uint8_t &aa, const VoxelRGBA &bb);
157  VoxelRGBA operator * (const uint16_t &aa, const VoxelRGBA &bb);
158  VoxelRGBA operator * (const uint32_t &aa, const VoxelRGBA &bb);
159  VoxelRGBA operator * (const uint64_t &aa, const VoxelRGBA &bb);
160  VoxelRGBA operator * (const float &aa, const VoxelRGBA &bb);
161  VoxelRGBA operator * (const double &aa, const VoxelRGBA &bb);
162  VoxelRGBA operator / (const VoxelRGBA &aa, const uint8_t &bb);
163  VoxelRGBA operator / (const VoxelRGBA &aa, const uint16_t &bb);
164  VoxelRGBA operator / (const VoxelRGBA &aa, const uint32_t &bb);
165  VoxelRGBA operator / (const VoxelRGBA &aa, const uint64_t &bb);
166  VoxelRGBA operator / (const VoxelRGBA &aa, const float &bb);
167  VoxelRGBA operator / (const VoxelRGBA &aa, const double &bb);
168  // long int are still used in volumes
169  VoxelRGBA operator * (const VoxelRGBA &aa, const long &bb);
170  VoxelRGBA operator * (const long &aa, const VoxelRGBA &bb);
171  VoxelRGBA operator / (const VoxelRGBA &aa, const long &bb);
172 
173 }
174 
175 #endif
RGBA Value.
VoxelRGB operator/(const VoxelRGB &aa, const uint8_t &bb)
Definition: voxelrgb_def.h:757
const uint8_t & blue() const
uint8_t & blue()
VoxelRGBA & operator*=(const uint8_t &value)
const uint8_t & red() const
VoxelRGB operator+(const VoxelRGB &aa, const VoxelRGB &bb)
Definition: voxelrgb_def.h:377
Base class for any multichannel data (RGB, RGBA, HSV, ...)
Definition: voxelvalue.h:58
VoxelRGB operator*(const VoxelRGB &aa, const uint8_t &bb)
Definition: voxelrgb_def.h:637
RGB Value.
Definition: voxelrgb_decl.h:71
uint8_t & green()
VoxelRGBA & operator=(const VoxelRGBA &other)
VoxelRGBA & operator-=(const VoxelRGBA &other)
const uint8_t & alpha() const
VoxelRGBA & operator+=(const VoxelRGBA &other)
VoxelRGB operator-(const VoxelRGB &aa, const VoxelRGB &bb)
Definition: voxelrgb_def.h:507
const uint8_t & green() const
static std::string dataType()
Definition: types.h:230
VoxelRGBA(const VoxelRGBA &other)
Definition: voxelrgba_def.h:61
uint8_t & alpha()
VoxelRGBA & operator/=(const uint8_t &value)