diff --git a/colour.cpp b/colour.cpp
index ae0e7c4e..9fab59f2 100644
--- a/colour.cpp
+++ b/colour.cpp
@@ -14,11 +14,13 @@
* You should have received a copy of the GNU General Public License
* along with libgim. If not, see .
*
- * Copyright 2010 Danny Robson
+ * Copyright 2010-2013 Danny Robson
*/
#include "colour.hpp"
+
#include "range.hpp"
+#include "random.hpp"
//-----------------------------------------------------------------------------
@@ -35,8 +37,12 @@ const util::colour util::colour::BLUE ({ 0.0, 0.0, 1.0, 1.0 });
//-----------------------------------------------------------------------------
+//! Extract a colour object from a JSON node.
+//!
+//! Data must be an array or 3 or 4 numbers. Guarantees success, or throws a
+//! json::type_error.
const json::node&
-util::operator>> (const json::node &node, colour &c) {
+operator>> (const json::node &node, colour &c) {
c.red = node[0].as_number ();
c.green = node[1].as_number ();
c.blue = node[2].as_number ();
@@ -71,7 +77,7 @@ namespace util {
//-----------------------------------------------------------------------------
std::ostream&
-util::operator<< (std::ostream &os, const util::colour &c) {
+operator<< (std::ostream &os, const util::colour &c) {
os << "colour(" << c.red << ", " << c.green << ", " << c.blue << ", " << c.alpha << ")";
return os;
}
diff --git a/colour.hpp b/colour.hpp
index 04df62e5..69247a02 100644
--- a/colour.hpp
+++ b/colour.hpp
@@ -14,18 +14,18 @@
* You should have received a copy of the GNU General Public License
* along with libgim. If not, see .
*
- * Copyright 2010 Danny Robson
+ * Copyright 2010-2013 Danny Robson
*/
#ifndef __UTIL_COLOUR_HPP
#define __UTIL_COLOUR_HPP
#include "json.hpp"
-#include "random.hpp"
#include
namespace util {
+ /// An RGBA colour POD type.
struct colour {
double red;
double green;
@@ -39,12 +39,9 @@ namespace util {
static const colour GREEN;
};
- template <> colour& randomise (colour&);
- template <> colour& random (void);
-
- std::ostream& operator<< (std::ostream&, const util::colour&);
- const json::node& operator>> (const json::node&, util::colour&);
}
+std::ostream& operator<< (std::ostream&, const util::colour&);
+const json::node& operator>> (const json::node&, util::colour&);
#endif