]> git.lyx.org Git - lyx.git/blob - src/Color.h
Avoid full metrics computation with Update:FitCursor
[lyx.git] / src / Color.h
1 // -*- C++ -*-
2 /**
3  * \file Color.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Asger Alstrup
8  * \author Lars Gullik Bjønnes
9  * \author Matthias Ettrich
10  * \author Jean-Marc Lasgouttes
11  * \author Angus Leeming
12  * \author John Levon
13  * \author André Pönitz
14  * \author Martin Vermeer
15  *
16  * Full author contact details are available in file CREDITS.
17  */
18
19 #ifndef COLOR_H
20 #define COLOR_H
21
22 #include "ColorCode.h"
23
24 #include "support/strfwd.h"
25
26 namespace lyx {
27
28 /**
29  * \class Color
30  *
31  * A class holding a definition of a certain color.
32  *
33  * A color can be one of the following kinds:
34  *
35  * - a single color, then mergeColor = Color_ignore
36  * - a merged color, i.e. the average of the base and merge colors.
37  */
38
39 class Color
40 {
41 public:
42         ///
43         Color(ColorCode base_color = Color_none);
44
45         /// \name Comparison operators
46         //@{
47         bool operator==(Color const & color) const;
48         bool operator!=(Color const & color) const;
49         bool operator<(Color const & color) const;
50         bool operator<=(Color const & color) const;
51         //@}
52
53         /// the base color
54         ColorCode baseColor;
55         /// The color that is merged with the base color. Set
56         /// mergeColor to Color_ignore if no merging is wanted.
57         ColorCode mergeColor;
58 };
59
60 std::ostream & operator<<(std::ostream & os, Color color);
61
62 std::string const X11hexname(RGBColor const & col);
63 RGBColor rgbFromHexName(std::string const & x11hexname);
64 std::string const outputLaTeXColor(RGBColor const & color);
65 /// Inverse of outputLaTeXColor
66 RGBColor const RGBColorFromLaTeX(std::string const & color);
67 /// Inverted color
68 RGBColor const inverseRGBColor(RGBColor color);
69
70 } // namespace lyx
71
72 #endif // COLOR_H