summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-03 20:29:45 +0200
committerCarl Hetherington <cth@carlh.net>2021-04-03 20:29:45 +0200
commit127b57acb9baab04014328dfbf7462d055090dc4 (patch)
treecc52b7da399d46bb2c7f6252881d6280870ec635 /src
parentb9c5e3f74550917676e14324791d6ba4d0c07cac (diff)
Add Luminance::value_in_foot_lamberts().
Diffstat (limited to 'src')
-rw-r--r--src/types.cc14
-rw-r--r--src/types.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/src/types.cc b/src/types.cc
index 44422ca9..743e7260 100644
--- a/src/types.cc
+++ b/src/types.cc
@@ -547,6 +547,20 @@ Luminance::string_to_unit (string u)
}
+float
+Luminance::value_in_foot_lamberts () const
+{
+ switch (_unit) {
+ case Unit::CANDELA_PER_SQUARE_METRE:
+ return _value / 3.426;
+ case Unit::FOOT_LAMBERT:
+ return _value;
+ default:
+ DCP_ASSERT (false);
+ }
+}
+
+
bool
dcp::operator== (Luminance const& a, Luminance const& b)
{
diff --git a/src/types.h b/src/types.h
index 374dd8b8..9dc3e5f5 100644
--- a/src/types.h
+++ b/src/types.h
@@ -444,6 +444,8 @@ public:
return _unit;
}
+ float value_in_foot_lamberts () const;
+
void as_xml (xmlpp::Element* parent, std::string ns) const;
static std::string unit_to_string (Unit u);