]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/Color.h
Tiny clean-ups.
[lyx.git] / src / frontends / xforms / Color.h
index 48b1d88599a829ec305b2a6d1a609877d18ae87f..79458b33bb7d1d70509e9968f2317cdd6a6d7b9a 100644 (file)
@@ -1,24 +1,36 @@
 // -*- C++ -*-
-/* This file is part of
- * ======================================================
- * 
- *           LyX, The Document Processor
- *      
- *         Copyright 1995 Matthias Ettrich
- *          Copyright 1995-2001 The LyX Team.
+/**
+ * \file Color.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *======================================================*/
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+/* structs RGBColor and HSVColor to enable simple conversion between
+ * color spaces.
+ */
 
 #ifndef COLOR_H
 #define COLOR_H
 
-#ifdef __GNUG_
-#pragma interface
-#endif
+#include <string>
+
+
+class LColor_color;
+
 
-#include "LString.h"
+/** Given col, fills r, g, b in the range 0-255.
+    The function returns true if successful.
+    It returns false on failure and sets r, g, b to 0. */
+bool getRGBColor(LColor_color col,
+                unsigned int & r, unsigned int & g, unsigned int & b);
 
 struct RGBColor;
+/// returns a string of form #rrggbb, given an RGBColor struct
+std::string const X11hexname(RGBColor const & col);
 
 struct HSVColor {
        double h;
@@ -31,22 +43,24 @@ struct HSVColor {
 };
 
 struct RGBColor {
-       int r;
-       int g;
-       int b;
+       unsigned int r;
+       unsigned int g;
+       unsigned int b;
        RGBColor() : r(0), g(0), b(0) {}
-       RGBColor(int red, int green, int blue)
+       RGBColor(unsigned int red, unsigned int green, unsigned int blue)
                : r(red), g(green), b(blue) {}
        RGBColor(HSVColor const &);
+       /// \param x11hexname is of the form "#ffa071"
+       RGBColor(std::string const & x11hexname);
 };
 
 struct NamedColor : public RGBColor {
-       string name;
+       std::string name;
        NamedColor() : RGBColor() {}
-       NamedColor(string const & n, RGBColor const & c )
+       NamedColor(std::string const & n, RGBColor const & c)
                : RGBColor(c), name(n) {}
        RGBColor const & color() const { return *this; }
-       string const & getname() const { return name; }
+       std::string const & getname() const { return name; }
 };
 
 inline