+/*\r
+* copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
+*\r
+* This file is part of CasparCG.\r
+*\r
+* CasparCG is free software: you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation, either version 3 of the License, or\r
+* (at your option) any later version.\r
+*\r
+* CasparCG is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+* GNU General Public License for more details.\r
+\r
+* You should have received a copy of the GNU General Public License\r
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
+*\r
+*/\r
#pragma once\r
\r
+#include <common/utility/tweener.h>\r
#include <core/video_format.h>\r
\r
#include <array>\r
+#include <type_traits>\r
\r
namespace caspar { namespace core {\r
\r
class image_transform \r
{\r
public:\r
+ \r
+ struct blend_mode\r
+ {\r
+ enum type \r
+ {\r
+ normal = 0,\r
+ lighten,\r
+ darken,\r
+ multiply,\r
+ average,\r
+ add,\r
+ subtract,\r
+ difference,\r
+ negation,\r
+ exclusion,\r
+ screen,\r
+ overlay,\r
+ soft_light,\r
+ hard_light,\r
+ color_dodge,\r
+ color_burn,\r
+ linear_dodge,\r
+ linear_burn,\r
+ linear_light,\r
+ vivid_light,\r
+ pin_light,\r
+ hard_mix,\r
+ reflect,\r
+ glow,\r
+ phoenix,\r
+ contrast,\r
+ saturation,\r
+ color,\r
+ luminosity,\r
+ blend_mode_count \r
+ };\r
+ };\r
+ \r
+ struct levels\r
+ {\r
+ levels() \r
+ : min_input(0.0)\r
+ , max_input(1.0)\r
+ , gamma(1.0)\r
+ , min_output(0.0)\r
+ , max_output(1.0)\r
+ { \r
+ }\r
+ double min_input;\r
+ double max_input;\r
+ double gamma;\r
+ double min_output;\r
+ double max_output;\r
+ };\r
+\r
image_transform();\r
\r
void set_opacity(double value);\r
\r
void set_gain(double value);\r
double get_gain() const;\r
+\r
+ void set_brightness(double value);\r
+ double get_brightness() const;\r
+\r
+ void set_contrast(double value);\r
+ double get_contrast() const;\r
+\r
+ void set_saturation(double value);\r
+ double get_saturation() const;\r
+ \r
+ void set_levels(const levels& value);\r
+ levels get_levels() const;\r
\r
void set_fill_translation(double x, double y);\r
std::array<double, 2> get_fill_translation() const;\r
void set_fill_scale(double x, double y);\r
std::array<double, 2> get_fill_scale() const;\r
\r
- void set_key_translation(double x, double y);\r
- std::array<double, 2> get_key_translation() const;\r
-\r
- void set_key_scale(double x, double y);\r
- std::array<double, 2> get_key_scale() const;\r
-\r
- void set_mode(video_mode::type mode);\r
- video_mode::type get_mode() const;\r
+ void set_clip_translation(double x, double y);\r
+ std::array<double, 2> get_clip_translation() const;\r
\r
+ void set_clip_scale(double x, double y);\r
+ std::array<double, 2> get_clip_scale() const;\r
+ \r
image_transform& operator*=(const image_transform &other);\r
const image_transform operator*(const image_transform &other) const;\r
+\r
+ void set_is_key(bool value);\r
+ bool get_is_key() const;\r
+\r
+ void set_blend_mode(blend_mode::type value);\r
+ blend_mode::type get_blend_mode() const;\r
+ \r
private:\r
double opacity_;\r
double gain_;\r
+ double contrast_;\r
+ double brightness_;\r
+ double saturation_;\r
+ double desaturation_;\r
+ levels levels_;\r
std::array<double, 2> fill_translation_; \r
std::array<double, 2> fill_scale_; \r
- std::array<double, 2> key_translation_; \r
- std::array<double, 2> key_scale_; \r
+ std::array<double, 2> clip_translation_; \r
+ std::array<double, 2> clip_scale_; \r
video_mode::type mode_;\r
+ bool is_key_;\r
+ blend_mode::type blend_mode_;\r
};\r
\r
-image_transform tween(const image_transform& lhs, const image_transform& rhs, const std::function<double(double, double, double)>& tweener, double delta);\r
+image_transform::blend_mode::type get_blend_mode(const std::wstring& str);\r
\r
-inline bool operator==(const image_transform& lhs, const image_transform& rhs)\r
-{\r
- return memcmp(&lhs, &rhs, sizeof(image_transform)) == 0;\r
-}\r
+image_transform tween(double time, const image_transform& source, const image_transform& dest, double duration, const tweener_t& tweener);\r
\r
-inline bool operator!=(const image_transform& lhs, const image_transform& rhs)\r
-{\r
- return !(lhs == rhs);\r
-}\r
+bool operator<(const image_transform& lhs, const image_transform& rhs);\r
+bool operator==(const image_transform& lhs, const image_transform& rhs);\r
+bool operator!=(const image_transform& lhs, const image_transform& rhs);\r
\r
}}
\ No newline at end of file