Add Luminance::value_in_foot_lamberts().
authorCarl Hetherington <cth@carlh.net>
Sat, 3 Apr 2021 18:29:45 +0000 (20:29 +0200)
committerCarl Hetherington <cth@carlh.net>
Sat, 3 Apr 2021 18:29:45 +0000 (20:29 +0200)
src/types.cc
src/types.h

index 44422ca96167fa72729bf73d2564ff5101fd163b..743e72606a5f176617f619e34d88567dd1d12227 100644 (file)
@@ -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)
 {
index 374dd8b8c1d22741deeafbd252ddae3ffe3340c2..9dc3e5f539475305d50d84dd6ca0098d5152d75c 100644 (file)
@@ -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);