summaryrefslogtreecommitdiff
path: root/libs/canvas/colors.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/canvas/colors.cc')
-rw-r--r--libs/canvas/colors.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/libs/canvas/colors.cc b/libs/canvas/colors.cc
index fc1bf47457..76b51d584f 100644
--- a/libs/canvas/colors.cc
+++ b/libs/canvas/colors.cc
@@ -17,6 +17,7 @@
*/
#include <algorithm>
+#include <sstream>
#include <cmath>
#include <stdint.h>
#include <cfloat>
@@ -236,6 +237,26 @@ HSV::HSV (Color c)
color_to_hsva (c, h, s, v, a);
}
+HSV::HSV (const std::string& str)
+{
+ stringstream ss (str);
+ ss >> h;
+ ss >> s;
+ ss >> v;
+ ss >> a;
+}
+
+string
+HSV::to_string () const
+{
+ stringstream ss;
+ ss << h << ' ';
+ ss << s << ' ';
+ ss << v << ' ';
+ ss << a;
+ return ss.str();
+}
+
bool
HSV::is_gray () const
{