Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
vpColor.cpp
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2019 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  * Color definition.
33  *
34  * Authors:
35  * Nicolas Melchior
36  * Fabien Spindler
37  *
38  *****************************************************************************/
39 
40 #include <visp3/core/vpColor.h>
41 
42 // FS: Sould be improved to avoid the #if preprocessor line. Not a good idea
43 // to define colors in static.
44 // See also vpColor.h where things need to be improved.
45 //#if !defined(visp_EXPORTS)
46 #if !defined(VISP_USE_MSVC) || (defined(VISP_USE_MSVC) && !defined(VISP_BUILD_SHARED_LIBS))
47 
48 vpColor const vpColor::black = vpColor(0, 0, 0, id_black);
51 vpColor const vpColor::white = vpColor(255, 255, 255, id_white);
54 vpColor const vpColor::lightGray = vpColor(192, 192, 192, id_lightGray);
56 vpColor const vpColor::gray = vpColor(128, 128, 128, id_gray);
59 vpColor const vpColor::darkGray = vpColor(64, 64, 64, id_darkGray);
62 vpColor const vpColor::lightRed = vpColor(255, 140, 140, id_lightRed);
65 vpColor const vpColor::red = vpColor(255, 0, 0, id_red);
68 vpColor const vpColor::darkRed = vpColor(128, 0, 0, id_darkRed);
71 vpColor const vpColor::lightGreen = vpColor(140, 255, 140, id_lightGreen);
74 vpColor const vpColor::green = vpColor(0, 255, 0, id_green);
77 vpColor const vpColor::darkGreen = vpColor(0, 128, 0, id_darkGreen);
80 vpColor const vpColor::lightBlue = vpColor(140, 140, 255, id_lightBlue);
83 vpColor const vpColor::blue = vpColor(0, 0, 255, id_blue);
86 vpColor const vpColor::darkBlue = vpColor(0, 0, 128, id_darkBlue);
89 vpColor const vpColor::yellow = vpColor(255, 255, 0, id_yellow);
92 vpColor const vpColor::cyan = vpColor(0, 255, 255, id_cyan);
95 vpColor const vpColor::orange = vpColor(255, 165, 0, id_orange);
98 vpColor const vpColor::purple = vpColor(128, 0, 128, id_purple);
100 vpColor const vpColor::none = vpColor(0, 0, 0, id_unknown);
101 
102 const unsigned int vpColor::nbColors = 18;
103 
106  vpColor::green, // 9
107  vpColor::red, // 6
108  vpColor::cyan, // 15
109  vpColor::purple, // 4
110  vpColor::yellow, // 14
111  vpColor::orange, // 16
112  vpColor::lightBlue, // 11
113  vpColor::lightGreen, // 8
114  vpColor::lightRed, // 5
115  vpColor::darkBlue, // 13
116  vpColor::darkGreen, // 10
117  vpColor::darkRed, // 7
118  vpColor::lightGray, // 2
119  vpColor::gray, // 3
120  vpColor::darkGray, // 4
121  vpColor::black, // 0
122  vpColor::white}; // 17
123 #endif
124 
126 
134 VISP_EXPORT bool operator==(const vpColor &c1, const vpColor &c2)
135 {
136  return ((c1.R == c2.R) && (c1.G == c2.G) && (c1.B == c2.B));
137 }
138 
147 VISP_EXPORT bool operator!=(const vpColor &c1, const vpColor &c2)
148 {
149  return ((c1.R != c2.R) || (c1.G != c2.G) || (c1.B == c2.B));
150 }
static const vpColor allColors[]
Definition: vpColor.h:195
unsigned char B
Blue component.
Definition: vpRGBa.h:150
static const vpColor black
Definition: vpColor.h:174
static const vpColor darkRed
Definition: vpColor.h:181
Class to define colors available for display functionnalities.
Definition: vpColor.h:120
static const vpColor none
Definition: vpColor.h:192
static const vpColor lightGray
Definition: vpColor.h:176
static const vpColor darkBlue
Definition: vpColor.h:187
unsigned char G
Green component.
Definition: vpRGBa.h:149
static const vpColor green
Definition: vpColor.h:183
static const vpColor lightRed
Definition: vpColor.h:179
static const vpColor red
Definition: vpColor.h:180
static const vpColor orange
Definition: vpColor.h:190
static const vpColor cyan
Definition: vpColor.h:189
static const vpColor lightGreen
Definition: vpColor.h:182
static const vpColor gray
Definition: vpColor.h:177
static const vpColor darkGray
Definition: vpColor.h:178
unsigned char R
Red component.
Definition: vpRGBa.h:148
static const vpColor darkGreen
Definition: vpColor.h:184
static const vpColor yellow
Definition: vpColor.h:188
static const vpColor lightBlue
Definition: vpColor.h:185
static const vpColor purple
Definition: vpColor.h:191
static const vpColor white
Definition: vpColor.h:175
static const unsigned int nbColors
Definition: vpColor.h:194
static const vpColor blue
Definition: vpColor.h:186