ViSP  2.10.0
vpRGBa.h
1 /****************************************************************************
2  *
3  * $Id: vpRGBa.h 4649 2014-02-07 14:57:11Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * RGBA pixel.
36  *
37  * Authors:
38  * Eric Marchand
39  * Fabien Spindler
40  *
41  *****************************************************************************/
42 
43 
44 #ifndef vpRGBa_h
45 #define vpRGBa_h
46 
53 #include <visp/vpColVector.h>
54 
55 
68 class VISP_EXPORT vpRGBa
69 {
70 public:
77  inline vpRGBa() : R(0), G(0), B(0), A(0) {};
78 
90  inline vpRGBa(const unsigned char &r, const unsigned char &g,
91  const unsigned char &b, const unsigned char &a=0)
92  : R(r), G(g), B(b), A(a) {};
93 
94 
103  inline vpRGBa(const unsigned char &v) : R(v), G(v), B(v), A(v) {};
104 
105 
109  inline vpRGBa(const vpRGBa &v) : R(v.R), G(v.G), B(v.B), A(v.A) {};
110 
120  inline vpRGBa(const vpColVector &v) : R(0), G(0), B(0), A(0)
121  {
122  *this = v;
123  };
124 
125  // We cannot add here the following destructor without changing the hypothesis that the size of this class is 4.
126  // With the destructor it becomes 16 that does break a lot of things arround image conversions
127  // virtual ~vpRGBa() {}; // Not to implement
128 
129  vpRGBa & operator=(const unsigned char &v) ;
130  vpRGBa & operator=(const vpRGBa &v) ;
131  vpRGBa & operator=(const vpColVector &v) ;
132  bool operator==(const vpRGBa &v);
133  bool operator!=(const vpRGBa &v);
134 
135  vpColVector operator-(const vpRGBa &v) const;
136  vpRGBa operator+(const vpRGBa &v) const;
137  vpColVector operator-(const vpColVector &v) const;
138  vpColVector operator+(const vpColVector &v) const;
139  vpColVector operator*(const float &v) const;
140  vpColVector operator*(const double &v) const;
141 
142  bool operator<(const vpRGBa &v) const;
143  bool operator>(const vpRGBa &v) const;
144 
145  public:
146  unsigned char R ;
147  unsigned char G ;
148  unsigned char B ;
149  unsigned char A ;
150 
151  friend VISP_EXPORT vpRGBa operator*(const double &x, const vpRGBa &rgb);
152 
153 } ;
154 
155 #endif
156 
157 /*
158  * Local variables:
159  * c-basic-offset: 2
160  * End:
161  */
vpRGBa(const unsigned char &r, const unsigned char &g, const unsigned char &b, const unsigned char &a=0)
Definition: vpRGBa.h:90
unsigned char B
Blue component.
Definition: vpRGBa.h:148
vpRGBa()
Definition: vpRGBa.h:77
unsigned char G
Green component.
Definition: vpRGBa.h:147
vpRGBa(const vpRGBa &v)
Definition: vpRGBa.h:109
Class that defines a RGB 32 bits structure.
Definition: vpRGBa.h:68
vpRGBa(const vpColVector &v)
Definition: vpRGBa.h:120
unsigned char A
Additionnal component.
Definition: vpRGBa.h:149
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Definition: vpColVector.h:72
unsigned char R
Red component.
Definition: vpRGBa.h:146
vpRGBa(const unsigned char &v)
Definition: vpRGBa.h:103