Visual Servoing Platform  version 3.0.0
vpRGBa.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2015 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See http://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * RGBA pixel.
32  *
33  * Authors:
34  * Eric Marchand
35  * Fabien Spindler
36  *
37  *****************************************************************************/
38 
39 
40 #ifndef vpRGBa_h
41 #define vpRGBa_h
42 
49 #include <visp3/core/vpColVector.h>
50 
51 
64 class VISP_EXPORT vpRGBa
65 {
66 public:
73  inline vpRGBa() : R(0), G(0), B(0), A(0) {};
74 
86  inline vpRGBa(const unsigned char &r, const unsigned char &g,
87  const unsigned char &b, const unsigned char &a=0)
88  : R(r), G(g), B(b), A(a) {};
89 
90 
99  inline vpRGBa(const unsigned char &v) : R(v), G(v), B(v), A(v) {};
100 
101 
105  inline vpRGBa(const vpRGBa &v) : R(v.R), G(v.G), B(v.B), A(v.A) {};
106 
116  inline vpRGBa(const vpColVector &v) : R(0), G(0), B(0), A(0)
117  {
118  *this = v;
119  };
120 
121  // We cannot add here the following destructor without changing the hypothesis that the size of this class is 4.
122  // With the destructor it becomes 16 that does break a lot of things arround image conversions
123  // virtual ~vpRGBa() {}; // Not to implement
124 
125  vpRGBa & operator=(const unsigned char &v) ;
126  vpRGBa & operator=(const vpRGBa &v) ;
127  vpRGBa & operator=(const vpColVector &v) ;
128  bool operator==(const vpRGBa &v);
129  bool operator!=(const vpRGBa &v);
130 
131  vpColVector operator-(const vpRGBa &v) const;
132  vpRGBa operator+(const vpRGBa &v) const;
133  vpColVector operator-(const vpColVector &v) const;
134  vpColVector operator+(const vpColVector &v) const;
135  vpColVector operator*(const float &v) const;
136  vpColVector operator*(const double &v) const;
137 
138  bool operator<(const vpRGBa &v) const;
139  bool operator>(const vpRGBa &v) const;
140 
141  public:
142  unsigned char R ;
143  unsigned char G ;
144  unsigned char B ;
145  unsigned char A ;
146 
147  friend VISP_EXPORT vpRGBa operator*(const double &x, const vpRGBa &rgb);
148 
149 } ;
150 
151 #endif
152 
153 /*
154  * Local variables:
155  * c-basic-offset: 2
156  * End:
157  */
vpRGBa(const unsigned char &r, const unsigned char &g, const unsigned char &b, const unsigned char &a=0)
Definition: vpRGBa.h:86
unsigned char B
Blue component.
Definition: vpRGBa.h:144
vpRGBa()
Definition: vpRGBa.h:73
unsigned char G
Green component.
Definition: vpRGBa.h:143
vpRGBa(const vpRGBa &v)
Definition: vpRGBa.h:105
Class that defines a RGB 32 bits structure.
Definition: vpRGBa.h:64
vpColVector operator*(const double &x, const vpColVector &v)
vpRGBa(const vpColVector &v)
Definition: vpRGBa.h:116
unsigned char A
Additionnal component.
Definition: vpRGBa.h:145
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
unsigned char R
Red component.
Definition: vpRGBa.h:142
vpRGBa(const unsigned char &v)
Definition: vpRGBa.h:99