Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpColor.cpp
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2025 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 * Color definition.
32 */
33
34#include <visp3/core/vpColor.h>
35
37// FS: Sould be improved to avoid the #if preprocessor line. Not a good idea
38// to define colors in static.
39// See also vpColor.h where things need to be improved.
40//#if !defined(visp_EXPORTS)
41#if !defined(VISP_USE_MSVC) || (defined(VISP_USE_MSVC) && !defined(VISP_BUILD_SHARED_LIBS))
43vpColor const vpColor::black = vpColor(0, 0, 0, id_black);
46vpColor const vpColor::white = vpColor(255, 255, 255, id_white);
49vpColor const vpColor::lightGray = vpColor(192, 192, 192, id_lightGray);
51vpColor const vpColor::gray = vpColor(128, 128, 128, id_gray);
54vpColor const vpColor::darkGray = vpColor(64, 64, 64, id_darkGray);
57vpColor const vpColor::lightRed = vpColor(255, 140, 140, id_lightRed);
60vpColor const vpColor::red = vpColor(255, 0, 0, id_red);
63vpColor const vpColor::darkRed = vpColor(128, 0, 0, id_darkRed);
66vpColor const vpColor::lightGreen = vpColor(140, 255, 140, id_lightGreen);
69vpColor const vpColor::green = vpColor(0, 255, 0, id_green);
72vpColor const vpColor::darkGreen = vpColor(0, 128, 0, id_darkGreen);
75vpColor const vpColor::lightBlue = vpColor(140, 140, 255, id_lightBlue);
78vpColor const vpColor::blue = vpColor(0, 0, 255, id_blue);
81vpColor const vpColor::darkBlue = vpColor(0, 0, 128, id_darkBlue);
84vpColor const vpColor::yellow = vpColor(255, 255, 0, id_yellow);
87vpColor const vpColor::cyan = vpColor(0, 255, 255, id_cyan);
90vpColor const vpColor::orange = vpColor(255, 165, 0, id_orange);
93vpColor const vpColor::purple = vpColor(128, 0, 128, id_purple);
95vpColor const vpColor::none = vpColor(0, 0, 0, id_unknown);
96
97const unsigned int vpColor::nbColors = 18;
98
101 vpColor::green, // 9
102 vpColor::red, // 6
103 vpColor::cyan, // 15
104 vpColor::purple, // 4
105 vpColor::yellow, // 14
106 vpColor::orange, // 16
107 vpColor::lightBlue, // 11
110 vpColor::darkBlue, // 13
111 vpColor::darkGreen, // 10
112 vpColor::darkRed, // 7
114 vpColor::gray, // 3
116 vpColor::black, // 0
117 vpColor::white }; // 17
118#endif
119
128VISP_EXPORT bool operator==(const vpColor &c1, const vpColor &c2)
129{
130 return ((c1.R == c2.R) && (c1.G == c2.G) && (c1.B == c2.B));
131}
132
142VISP_EXPORT bool operator!=(const vpColor &c1, const vpColor &c2)
143{
144 return ((c1.R != c2.R) || (c1.G != c2.G) || (c1.B == c2.B));
145}
146
147END_VISP_NAMESPACE
Class to define RGB colors available for display functionalities.
Definition vpColor.h:157
static const vpColor white
Definition vpColor.h:193
static const vpColor red
Definition vpColor.h:198
static const vpColor darkGray
Definition vpColor.h:196
static const vpColor cyan
Definition vpColor.h:207
static const vpColor none
Definition vpColor.h:210
static const vpColor orange
Definition vpColor.h:208
static const vpColor darkRed
Definition vpColor.h:199
static const vpColor blue
Definition vpColor.h:204
static const vpColor lightGray
Definition vpColor.h:194
static const vpColor lightBlue
Definition vpColor.h:203
static const vpColor darkGreen
Definition vpColor.h:202
static const unsigned int nbColors
Definition vpColor.h:212
friend VISP_EXPORT bool operator!=(const vpColor &c1, const vpColor &c2)
Definition vpColor.cpp:142
static const vpColor darkBlue
Definition vpColor.h:205
static const vpColor purple
Definition vpColor.h:209
static const vpColor lightGreen
Definition vpColor.h:200
static const vpColor yellow
Definition vpColor.h:206
static const vpColor allColors[]
Definition vpColor.h:100
vpColor()
Definition vpColor.h:222
static const vpColor lightRed
Definition vpColor.h:197
friend VISP_EXPORT bool operator==(const vpColor &c1, const vpColor &c2)
Definition vpColor.cpp:128
static const vpColor black
Definition vpColor.h:192
static const vpColor green
Definition vpColor.h:201
static const vpColor gray
Definition vpColor.h:195
unsigned char B
Blue component.
Definition vpRGBa.h:327
unsigned char R
Red component.
Definition vpRGBa.h:325
unsigned char G
Green component.
Definition vpRGBa.h:326