From e8bb753ea7f1dfe2dac761050f47ea1cb786f01b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 21 Aug 2012 18:32:11 +0100 Subject: Pick up subtitle color. --- src/types.cc | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/types.cc') 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 +#include #include #include #include "types.h" @@ -18,3 +19,41 @@ Fraction::Fraction (string s) numerator = lexical_cast (b[0]); denominator = lexical_cast (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; +} -- cgit v1.2.3