summaryrefslogtreecommitdiff
path: root/src/subtitle_asset.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-08-21 22:14:58 +0100
committerCarl Hetherington <cth@carlh.net>2012-08-21 22:14:58 +0100
commitb627827aaa5a314b53fe0f8b0429dee8b542ccb3 (patch)
tree243ffd04fb1eb023888ae214099f893ca7e9fd2c /src/subtitle_asset.cc
parentfd23bf276facab3892a00f010ac7e991bc79af09 (diff)
Do effects with an enum.
Diffstat (limited to 'src/subtitle_asset.cc')
-rw-r--r--src/subtitle_asset.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc
index 2eeceab1..827fbf7d 100644
--- a/src/subtitle_asset.cc
+++ b/src/subtitle_asset.cc
@@ -66,7 +66,7 @@ SubtitleAsset::examine_font_node (shared_ptr<FontNode> font_node, list<shared_pt
(*j)->out,
(*k)->v_position,
(*k)->text,
- effective.effect,
+ effective.effect.get(),
effective.effect_color.get()
)
)
@@ -88,7 +88,16 @@ FontNode::FontNode (xmlpp::Node const * node)
size = optional_int64_attribute ("Size");
italic = optional_bool_attribute ("Italic");
color = optional_color_attribute ("Color");
- effect = optional_string_attribute ("Effect");
+ string const e = optional_string_attribute ("Effect");
+ if (e == "none") {
+ effect = NONE;
+ } else if (e == "border") {
+ effect = BORDER;
+ } else if (e == "shadow") {
+ effect = SHADOW;
+ } else if (!e.empty ()) {
+ throw DCPReadError ("unknown subtitle effect type");
+ }
effect_color = optional_color_attribute ("EffectColor");
subtitle_nodes = sub_nodes<SubtitleNode> ("Subtitle");
font_nodes = sub_nodes<FontNode> ("Font");
@@ -98,6 +107,7 @@ FontNode::FontNode (list<shared_ptr<FontNode> > const & font_nodes)
: size (0)
, italic (false)
, color ("FFFFFFFF")
+ , effect_color ("FFFFFFFF")
{
for (list<shared_ptr<FontNode> >::const_iterator i = font_nodes.begin(); i != font_nodes.end(); ++i) {
if (!(*i)->id.empty ()) {
@@ -112,8 +122,8 @@ FontNode::FontNode (list<shared_ptr<FontNode> > const & font_nodes)
if ((*i)->color) {
color = (*i)->color.get ();
}
- if (!(*i)->effect.empty ()) {
- effect = (*i)->effect;
+ if ((*i)->effect) {
+ effect = (*i)->effect.get ();
}
if ((*i)->effect_color) {
effect_color = (*i)->effect_color.get ();
@@ -185,7 +195,7 @@ Subtitle::Subtitle (
Time out,
float v_position,
string text,
- string effect,
+ Effect effect,
Color effect_color
)
: _font (font)