diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-01-09 20:32:31 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-01-09 20:32:31 +0000 |
| commit | 6a0a88cdf8ab69e9f8664c747ee752c516e4fe4e (patch) | |
| tree | 69fbb9da8e5799e31f2c88c815db022321fc5e6a /src | |
| parent | 9b74a2f5f92fd6244177cb041d7019f76df697e9 (diff) | |
Add a method to convert to a libdcp colour.
Diffstat (limited to 'src')
| -rw-r--r-- | src/colour.h | 8 |
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 |
