Visual Servoing Platform  version 3.6.1 under development (2024-04-23)
vpRGBf.h
1 /*
2  * ViSP, open source Visual Servoing Platform software.
3  * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
4  *
5  * This software is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
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 https://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  * 32-bit floating point RGB pixel.
32  */
33 
34 #ifndef vpRGBf_h
35 #define vpRGBf_h
36 
43 #include <visp3/core/vpColVector.h>
44 
56 class VISP_EXPORT vpRGBf
57 {
58 public:
64  inline vpRGBf() : R(0), G(0), B(0) { }
65 
75  inline vpRGBf(float r, float g, float b)
76  : R(r), G(g), B(b)
77  { }
78 
86  inline vpRGBf(float v) : R(v), G(v), B(v) { }
87 
91  inline vpRGBf(const vpRGBf &v) : R(v.R), G(v.G), B(v.B) { }
92 
100  inline vpRGBf(const vpColVector &v) : R(0), G(0), B(0) { *this = v; }
101 
102  vpRGBf &operator=(float v);
103  vpRGBf &operator=(const vpRGBf &v);
104 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
105  vpRGBf &operator=(const vpRGBf &&v);
106 #endif
107  vpRGBf &operator=(const vpColVector &v);
108  bool operator==(const vpRGBf &v) const;
109  bool operator!=(const vpRGBf &v) const;
110 
111  vpColVector operator-(const vpRGBf &v) const;
112  vpRGBf operator+(const vpRGBf &v) const;
113  vpColVector operator-(const vpColVector &v) const;
114  vpColVector operator+(const vpColVector &v) const;
115  vpColVector operator*(float v) const;
116  vpColVector operator*(double v) const;
117 
118  bool operator<(const vpRGBf &v) const;
119  bool operator>(const vpRGBf &v) const;
120 
121  friend VISP_EXPORT std::ostream &operator<<(std::ostream &os, const vpRGBf &rgb);
122 
123 public:
124  float R;
125  float G;
126  float B;
127 
128  friend VISP_EXPORT vpRGBf operator*(double x, const vpRGBf &rgb);
129 };
130 
131 #endif
Implementation of column vector and the associated operations.
Definition: vpColVector.h:163
Definition: vpRGBf.h:57
vpRGBf()
Definition: vpRGBf.h:64
vpRGBf(const vpColVector &v)
Definition: vpRGBf.h:100
float B
Blue component.
Definition: vpRGBf.h:126
vpRGBf(float r, float g, float b)
Definition: vpRGBf.h:75
vpRGBf(float v)
Definition: vpRGBf.h:86
float G
Green component.
Definition: vpRGBf.h:125
vpRGBf(const vpRGBf &v)
Definition: vpRGBf.h:91
float R
Red component.
Definition: vpRGBf.h:124
vpMatrix operator*(const double &x, const vpMatrix &A)