Visual Servoing Platform  version 3.6.1 under development (2024-12-07)
vpRGBf.h
1 /*
2  * ViSP, open source Visual Servoing Platform software.
3  * Copyright (C) 2005 - 2024 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 
40 #ifndef VP_RGBF_H
41 #define VP_RGBF_H
42 
43 #include <visp3/core/vpConfig.h>
44 #include <visp3/core/vpColVector.h>
45 
46 BEGIN_VISP_NAMESPACE
47 
59 class VISP_EXPORT vpRGBf
60 {
61 public:
67  inline vpRGBf() : R(0), G(0), B(0) { }
68 
78  inline vpRGBf(float r, float g, float b)
79  : R(r), G(g), B(b)
80  { }
81 
89  VP_EXPLICIT inline vpRGBf(float v) : R(v), G(v), B(v) { }
90 
98  VP_EXPLICIT inline vpRGBf(int v)
99  {
100  *this = v;
101  }
102 
106  inline vpRGBf(const vpRGBf &v) : R(v.R), G(v.G), B(v.B) { }
107 
115  VP_EXPLICIT inline vpRGBf(const vpColVector &v) : R(0), G(0), B(0) { *this = v; }
116 
117  vpRGBf &operator=(float v);
118  vpRGBf &operator=(int v);
119  vpRGBf &operator=(const vpRGBf &v);
120 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
121  vpRGBf &operator=(const vpRGBf &&v);
122 #endif
123  vpRGBf &operator=(const vpColVector &v);
124  bool operator==(const vpRGBf &v) const;
125  bool operator!=(const vpRGBf &v) const;
126 
127  vpColVector operator-(const vpRGBf &v) const;
128  vpRGBf operator+(const vpRGBf &v) const;
129  vpColVector operator-(const vpColVector &v) const;
130  vpColVector operator+(const vpColVector &v) const;
131  vpColVector operator*(float v) const;
132  vpColVector operator*(double v) const;
133 
134  bool operator<(const vpRGBf &v) const;
135  bool operator>(const vpRGBf &v) const;
136 
137  friend VISP_EXPORT std::ostream &operator<<(std::ostream &os, const vpRGBf &rgb);
138 
139 public:
140  float R;
141  float G;
142  float B;
143 
144  friend VISP_EXPORT vpRGBf operator*(double x, const vpRGBf &rgb);
145  friend VISP_EXPORT vpRGBf operator*(float x, const vpRGBf &rgb);
146 };
147 END_VISP_NAMESPACE
148 #endif
Implementation of column vector and the associated operations.
Definition: vpColVector.h:191
Definition: vpRGBf.h:60
vpRGBf()
Definition: vpRGBf.h:67
float B
Blue component.
Definition: vpRGBf.h:142
VP_EXPLICIT vpRGBf(const vpColVector &v)
Definition: vpRGBf.h:115
vpRGBf(float r, float g, float b)
Definition: vpRGBf.h:78
VP_EXPLICIT vpRGBf(int v)
Definition: vpRGBf.h:98
VP_EXPLICIT vpRGBf(float v)
Definition: vpRGBf.h:89
float G
Green component.
Definition: vpRGBf.h:141
vpRGBf(const vpRGBf &v)
Definition: vpRGBf.h:106
float R
Red component.
Definition: vpRGBf.h:140
vpMatrix operator*(const double &x, const vpMatrix &A)