1 #include "../stdafx.h"
\r
3 #include "image_transform.h"
\r
5 namespace caspar { namespace core {
\r
7 image_transform::image_transform()
\r
10 , mode_(video_mode::invalid)
\r
12 std::fill(fill_translation_.begin(), fill_translation_.end(), 0.0);
\r
13 std::fill(fill_scale_.begin(), fill_scale_.end(), 1.0);
\r
14 std::fill(key_translation_.begin(), key_translation_.end(), 0.0);
\r
15 std::fill(key_scale_.begin(), key_scale_.end(), 1.0);
\r
18 void image_transform::set_opacity(double value)
\r
23 double image_transform::get_opacity() const
\r
28 void image_transform::set_gain(double value)
\r
33 double image_transform::get_gain() const
\r
38 void image_transform::set_image_translation(double x, double y)
\r
40 fill_translation_[0] = x;
\r
41 fill_translation_[1] = y;
\r
44 void image_transform::set_image_scale(double x, double y)
\r
47 fill_scale_[1] = y;
\r
50 std::array<double, 2> image_transform::get_image_translation() const
\r
52 return fill_translation_;
\r
55 std::array<double, 2> image_transform::get_image_scale() const
\r
60 void image_transform::set_mask_translation(double x, double y)
\r
62 key_translation_[0] = x;
\r
63 key_translation_[1] = y;
\r
66 void image_transform::set_mask_scale(double x, double y)
\r
72 std::array<double, 2> image_transform::get_mask_translation() const
\r
74 return key_translation_;
\r
77 std::array<double, 2> image_transform::get_mask_scale() const
\r
82 void image_transform::set_mode(video_mode::type mode)
\r
87 video_mode::type image_transform::get_mode() const
\r
92 image_transform& image_transform::operator*=(const image_transform &other)
\r
94 opacity_ *= other.opacity_;
\r
95 mode_ = other.mode_;
\r
96 gain_ *= other.gain_;
\r
97 fill_translation_[0] += other.fill_translation_[0]*fill_scale_[0];
\r
98 fill_translation_[1] += other.fill_translation_[1]*fill_scale_[1];
\r
99 fill_scale_[0] *= other.fill_scale_[0];
\r
100 fill_scale_[1] *= other.fill_scale_[1];
\r
101 key_translation_[0] += other.key_translation_[0]*key_scale_[0];
\r
102 key_translation_[1] += other.key_translation_[1]*key_scale_[1];
\r
103 key_scale_[0] *= other.key_scale_[0];
\r
104 key_scale_[1] *= other.key_scale_[1];
\r
108 const image_transform image_transform::operator*(const image_transform &other) const
\r
110 return image_transform(*this) *= other;
\r