MRPT  1.9.9
TColorManager.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include <mrpt/img/TColor.h>
12 #include <cstdlib>
13 #include <iostream>
14 #include <set>
15 #include <utility>
16 
17 namespace mrpt::img
18 {
19 // TODO - finish this.
20 /**\brief Manage R, G, B color triads and ask class instance of the next
21  * unique RGB combination.
22  */
24 {
25  public:
26  /**\brief Constructor */
28  /**\brief Destructor */
30  /**\brief Get the next RGB triad in TColorf form.
31  *
32  * Method automatically advances the current counters for RGB.
33  */
35  /**\brief Get the next RGB triad in TColor form.
36  *
37  * Method automatically advances the current counters for RGB.
38  */
41  std::set<mrpt::img::TColor> used_colors;
42  /** Indicates if the standard colors are to be returned first.
43  */
45  /** Indicates if the standard colors have already been used.
46  *
47  * This is a cached version of the value returned from the
48  * checkStdColorsUsed method.
49  *
50  * \note Standard colors are: red, green, blue
51  *
52  * \sa checkStdColorsUsed
53  */
55  /**\brief Check if the standard colors have already been used.
56  *
57  * \ret True if they have indeed been used.
58  */
59  bool checkStdColorsUsed();
60 
61  uint8_t color_step;
62  const uint8_t color_thresh{255};
63 
65 
66  private:
67  // color triad with which to advance the current TColor instance
69 
70  /**\brief Reset all class properties to their default values
71  *
72  * Method called in the constructor of the class
73  */
74  void reset();
75  void advanceRGBCounters();
76  /**\brief Mark the given color as used. */
78 };
79 } // namespace mrpt::img
void markColorAsUsed(mrpt::img::TColor color)
Mark the given color as used.
bool checkStdColorsUsed()
Check if the standard colors have already been used.
mrpt::img::TColor getNextTColor()
Get the next RGB triad in TColor form.
mrpt::img::TColor color_step_triad
Definition: TColorManager.h:68
bool use_standard_colors_first
Indicates if the standard colors are to be returned first.
Definition: TColorManager.h:44
mrpt::img::TColorf getNextTColorf()
Get the next RGB triad in TColorf form.
~TColorManager()
Destructor.
const uint8_t color_thresh
Definition: TColorManager.h:62
void reset()
Reset all class properties to their default values.
An RGBA color - floats in the range [0,1].
Definition: TColor.h:88
mrpt::img::TColor curr_color
Definition: TColorManager.h:40
bool have_used_standard_colors
Indicates if the standard colors have already been used.
Definition: TColorManager.h:54
A RGB color - 8bit.
Definition: TColor.h:25
TColorManager(bool use_standard_colors_first=true)
Constructor.
Manage R, G, B color triads and ask class instance of the next unique RGB combination.
Definition: TColorManager.h:23
std::set< mrpt::img::TColor > used_colors
Definition: TColorManager.h:41



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: c7a3bec24 Sun Mar 29 18:33:13 2020 +0200 at dom mar 29 18:50:38 CEST 2020