- auto& pos = transform.image_transform.fill_translation;
- auto& scale = transform.image_transform.fill_scale;
-
- pos[0] = static_cast<double>(layer.position.x.get()) / static_cast<double>(pixel_constraints_.width.get());
- pos[1] = static_cast<double>(layer.position.y.get()) / static_cast<double>(pixel_constraints_.height.get());
- scale[0] = static_cast<double>(layer.producer.get()->pixel_constraints().width.get())
- / static_cast<double>(pixel_constraints_.width.get());
- scale[1] = static_cast<double>(layer.producer.get()->pixel_constraints().height.get())
- / static_cast<double>(pixel_constraints_.height.get());
+ auto& anchor = transform.image_transform.anchor;
+ auto& pos = transform.image_transform.fill_translation;
+ auto& scale = transform.image_transform.fill_scale;
+ auto& angle = transform.image_transform.angle;
+ auto& crop = transform.image_transform.crop;
+ auto& pers = transform.image_transform.perspective;
+
+ anchor[0] = layer.anchor.x.get() / layer.producer.get()->pixel_constraints().width.get();
+ anchor[1] = layer.anchor.y.get() / layer.producer.get()->pixel_constraints().height.get();
+ pos[0] = layer.position.x.get() / pixel_constraints_.width.get();
+ pos[1] = layer.position.y.get() / pixel_constraints_.height.get();
+ scale[0] = layer.producer.get()->pixel_constraints().width.get() / pixel_constraints_.width.get();
+ scale[1] = layer.producer.get()->pixel_constraints().height.get() / pixel_constraints_.height.get();
+ crop.ul[0] = layer.crop.upper_left.x.get() / layer.producer.get()->pixel_constraints().width.get();
+ crop.ul[1] = layer.crop.upper_left.y.get() / layer.producer.get()->pixel_constraints().height.get();
+ crop.lr[0] = layer.crop.lower_right.x.get() / layer.producer.get()->pixel_constraints().width.get();
+ crop.lr[1] = layer.crop.lower_right.y.get() / layer.producer.get()->pixel_constraints().height.get();
+ pers.ul[0] = layer.perspective.upper_left.x.get() / layer.producer.get()->pixel_constraints().width.get();
+ pers.ul[1] = layer.perspective.upper_left.y.get() / layer.producer.get()->pixel_constraints().height.get();
+ pers.ur[0] = layer.perspective.upper_right.x.get() / layer.producer.get()->pixel_constraints().width.get();
+ pers.ur[1] = layer.perspective.upper_right.y.get() / layer.producer.get()->pixel_constraints().height.get();
+ pers.lr[0] = layer.perspective.lower_right.x.get() / layer.producer.get()->pixel_constraints().width.get();
+ pers.lr[1] = layer.perspective.lower_right.y.get() / layer.producer.get()->pixel_constraints().height.get();
+ pers.ll[0] = layer.perspective.lower_left.x.get() / layer.producer.get()->pixel_constraints().width.get();
+ pers.ll[1] = layer.perspective.lower_left.y.get() / layer.producer.get()->pixel_constraints().height.get();
+
+ static const double PI = 3.141592653589793;
+
+ angle = layer.rotation.get() * PI / 180.0;
+
+ transform.image_transform.opacity = layer.adjustments.opacity.get();
+ transform.image_transform.is_key = layer.is_key.get();
+ transform.image_transform.use_mipmap = layer.use_mipmap.get();
+ transform.image_transform.blend_mode = layer.blend_mode.get();
+ transform.image_transform.chroma.enable = layer.chroma_key.enable.get();
+ transform.image_transform.chroma.target_hue = layer.chroma_key.target_hue.get();
+ transform.image_transform.chroma.hue_width = layer.chroma_key.hue_width.get();
+ transform.image_transform.chroma.min_saturation = layer.chroma_key.min_saturation.get();
+ transform.image_transform.chroma.min_brightness = layer.chroma_key.min_brightness.get();
+ transform.image_transform.chroma.softness = layer.chroma_key.softness.get();
+ transform.image_transform.chroma.spill = layer.chroma_key.spill.get();
+ transform.image_transform.chroma.spill_darken = layer.chroma_key.spill_darken.get();
+
+ // Mark as sublayer, so it will be composited separately by the mixer.
+ transform.image_transform.layer_depth = 1;