Visual Servoing Platform  version 3.0.0
vpColor.cpp
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  * Color definition.
32  *
33  * Authors:
34  * Nicolas Melchior
35  * Fabien Spindler
36  *
37  *****************************************************************************/
38 
39 #include <visp3/core/vpColor.h>
40 
41 // FS: Sould be improved to avoid the #if preprocessor line. Not a good idea to define colors in static.
42 // See also vpColor.h where things need to be improved.
43 //#if !defined(visp_EXPORTS)
44 #if !defined(VISP_USE_MSVC) || (defined(VISP_USE_MSVC) && !defined(VISP_BUILD_SHARED_LIBS))
45 
46 vpColor const vpColor::black = vpColor(0, 0, 0, id_black);
48 vpColor const vpColor::white = vpColor(255, 255, 255, id_white);
50 vpColor const vpColor::lightGray = vpColor(192, 192, 192, id_lightGray);
52 vpColor const vpColor::gray = vpColor(128, 128, 128, id_gray);
54 vpColor const vpColor::darkGray = vpColor(64, 64, 64, id_darkGray);
57 vpColor const vpColor::lightRed = vpColor(255, 140, 140, id_lightRed);
60 vpColor const vpColor::red = vpColor(255, 0, 0, id_red);
63 vpColor const vpColor::darkRed = vpColor(128, 0, 0, id_darkRed);
66 vpColor const vpColor::lightGreen = vpColor(140, 255, 140, id_lightGreen);
69 vpColor const vpColor::green = vpColor(0, 255, 0, id_green);
72 vpColor const vpColor::darkGreen = vpColor(0, 128, 0, id_darkGreen);
75 vpColor const vpColor::lightBlue = vpColor(140, 140, 255, id_lightBlue);
78 vpColor const vpColor::blue = vpColor(0, 0, 255, id_blue);
81 vpColor const vpColor::darkBlue = vpColor(0, 0, 128, id_darkBlue);
84 vpColor const vpColor::yellow = vpColor(255, 255, 0, id_yellow);
87 vpColor const vpColor::cyan = vpColor(0, 255, 255, id_cyan);
90 vpColor const vpColor::orange = vpColor(255, 165, 0, id_orange);
93 vpColor const vpColor::purple = vpColor(128, 0, 128, id_purple);
95 vpColor const vpColor::none = vpColor(0, 0, 0, id_unknown);
96 
97 const unsigned int vpColor::nbColors = 18;
98 
101  vpColor::blue , // 12
102  vpColor::green , // 9
103  vpColor::red , // 6
104  vpColor::cyan , // 15
105  vpColor::purple , // 4
106  vpColor::yellow , // 14
107  vpColor::orange , // 16
108  vpColor::lightBlue ,// 11
110  vpColor::lightRed , // 5
111  vpColor::darkBlue , // 13
112  vpColor::darkGreen ,// 10
113  vpColor::darkRed , // 7
114  vpColor::lightGray ,// 2
115  vpColor::gray , // 3
116  vpColor::darkGray , // 4
117  vpColor::black , // 0
118  vpColor::white}; // 17
119 #endif
120 
122 
130 VISP_EXPORT bool operator==( const vpColor &c1, const vpColor &c2 ) {
131  return ( ( c1.R == c2.R ) && ( c1.G == c2.G ) && ( c1.B == c2.B) );
132 }
133 
142 VISP_EXPORT bool operator!=( const vpColor &c1, const vpColor &c2 ) {
143  return ( ( c1.R != c2.R ) || ( c1.G != c2.G ) || ( c1.B == c2.B) );
144 }
static const vpColor allColors[]
Definition: vpColor.h:178
unsigned char B
Blue component.
Definition: vpRGBa.h:144
static const vpColor black
Definition: vpColor.h:157
static const vpColor darkRed
Definition: vpColor.h:164
Class to define colors available for display functionnalities.
Definition: vpColor.h:121
static const vpColor none
Definition: vpColor.h:175
static const vpColor lightGray
Definition: vpColor.h:159
static const vpColor darkBlue
Definition: vpColor.h:170
unsigned char G
Green component.
Definition: vpRGBa.h:143
static const vpColor green
Definition: vpColor.h:166
static const vpColor lightRed
Definition: vpColor.h:162
static const vpColor red
Definition: vpColor.h:163
static const vpColor orange
Definition: vpColor.h:173
static const vpColor cyan
Definition: vpColor.h:172
static const vpColor lightGreen
Definition: vpColor.h:165
static const vpColor gray
Definition: vpColor.h:160
static const vpColor darkGray
Definition: vpColor.h:161
unsigned char R
Red component.
Definition: vpRGBa.h:142
static const vpColor darkGreen
Definition: vpColor.h:167
static const vpColor yellow
Definition: vpColor.h:171
static const vpColor lightBlue
Definition: vpColor.h:168
static const vpColor purple
Definition: vpColor.h:174
static const vpColor white
Definition: vpColor.h:158
static const unsigned int nbColors
Definition: vpColor.h:177
static const vpColor blue
Definition: vpColor.h:169