summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-01-09 20:32:31 +0000
committerCarl Hetherington <cth@carlh.net>2018-01-09 20:32:31 +0000
commit6a0a88cdf8ab69e9f8664c747ee752c516e4fe4e (patch)
tree69fbb9da8e5799e31f2c88c815db022321fc5e6a
parent9b74a2f5f92fd6244177cb041d7019f76df697e9 (diff)
Add a method to convert to a libdcp colour.
-rw-r--r--src/colour.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/colour.h b/src/colour.h
index 55d2239..dbdd534 100644
--- a/src/colour.h
+++ b/src/colour.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,7 +20,9 @@
#ifndef LIBSUB_COLOUR_H
#define LIBSUB_COLOUR_H
+#include <dcp/types.h>
#include <string>
+#include <cmath>
namespace sub {
@@ -51,6 +53,10 @@ public:
float g;
/** blue component (from 0 to 1) */
float b;
+
+ dcp::Colour dcp() const {
+ return dcp::Colour(lrintf(r * 255), lrintf(g * 255), lrintf(b * 255));
+ }
};
bool