summaryrefslogtreecommitdiff
path: root/src/types.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-08-21 18:32:11 +0100
committerCarl Hetherington <cth@carlh.net>2012-08-21 18:32:11 +0100
commite8bb753ea7f1dfe2dac761050f47ea1cb786f01b (patch)
tree514f2e1043e34b5e2233642d075b31fd6d1812f4 /src/types.cc
parent3fc1eba823a52603aa58f3df6f08dc4e73309c63 (diff)
Pick up subtitle color.
Diffstat (limited to 'src/types.cc')
-rw-r--r--src/types.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/types.cc b/src/types.cc
index 85c5fd6e..39d7fea5 100644
--- a/src/types.cc
+++ b/src/types.cc
@@ -1,4 +1,5 @@
#include <vector>
+#include <cstdio>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include "types.h"
@@ -18,3 +19,41 @@ Fraction::Fraction (string s)
numerator = lexical_cast<int> (b[0]);
denominator = lexical_cast<int> (b[1]);
}
+
+Color::Color ()
+ : r (0)
+ , g (0)
+ , b (0)
+{
+
+}
+
+Color::Color (int r_, int g_, int b_)
+ : r (r_)
+ , g (g_)
+ , b (b_)
+{
+
+}
+
+Color::Color (string argb_hex)
+{
+ int alpha;
+ if (sscanf (argb_hex.c_str(), "%2x%2x%2x%2x", &alpha, &r, &g, &b) < 4) {
+ throw XMLError ("could not parse colour string");
+ }
+}
+
+
+bool
+libdcp::operator== (Color const & a, Color const & b)
+{
+ return (a.r == b.r && a.g == b.g && a.b == b.b);
+}
+
+ostream &
+libdcp::operator<< (ostream& s, Color const & c)
+{
+ s << "(" << c.r << ", " << c.g << ", " << c.b << ")";
+ return s;
+}