Visual Servoing Platform  version 3.5.1 under development (2023-04-02)
vpRGBf.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2022 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See http://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * 32-bit floating point RGB pixel.
33  *
34  *****************************************************************************/
35 
36 #ifndef vpRGBf_h
37 #define vpRGBf_h
38 
45 #include <visp3/core/vpColVector.h>
46 
58 class VISP_EXPORT vpRGBf
59 {
60 public:
66  inline vpRGBf() : R(0), G(0), B(0) {}
67 
77  inline vpRGBf(float r, float g, float b)
78  : R(r), G(g), B(b)
79  {
80  }
81 
89  inline vpRGBf(float v) : R(v), G(v), B(v) {}
90 
94  inline vpRGBf(const vpRGBf &v) : R(v.R), G(v.G), B(v.B) {}
95 
103  inline vpRGBf(const vpColVector &v) : R(0), G(0), B(0) { *this = v; }
104 
105  vpRGBf &operator=(float v);
106  vpRGBf &operator=(const vpRGBf &v);
107 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
108  vpRGBf &operator=(const vpRGBf &&v);
109 #endif
110  vpRGBf &operator=(const vpColVector &v);
111  bool operator==(const vpRGBf &v);
112  bool operator!=(const vpRGBf &v);
113 
114  vpColVector operator-(const vpRGBf &v) const;
115  vpRGBf operator+(const vpRGBf &v) const;
116  vpColVector operator-(const vpColVector &v) const;
117  vpColVector operator+(const vpColVector &v) const;
118  vpColVector operator*(float v) const;
119  vpColVector operator*(double v) const;
120 
121  bool operator<(const vpRGBf &v) const;
122  bool operator>(const vpRGBf &v) const;
123 
124  friend VISP_EXPORT std::ostream &operator<<(std::ostream &os, const vpRGBf &rgb);
125 
126 public:
127  float R;
128  float G;
129  float B;
130 
131  friend VISP_EXPORT vpRGBf operator*(double x, const vpRGBf &rgb);
132 };
133 
134 #endif
Implementation of column vector and the associated operations.
Definition: vpColVector.h:131
Definition: vpRGBf.h:59
vpRGBf()
Definition: vpRGBf.h:66
vpRGBf(const vpColVector &v)
Definition: vpRGBf.h:103
float B
Blue component.
Definition: vpRGBf.h:129
vpRGBf(float r, float g, float b)
Definition: vpRGBf.h:77
vpRGBf(float v)
Definition: vpRGBf.h:89
float G
Green component.
Definition: vpRGBf.h:128
vpRGBf(const vpRGBf &v)
Definition: vpRGBf.h:94
float R
Red component.
Definition: vpRGBf.h:127
vpColVector operator*(const double &x, const vpColVector &v)