Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Merge upstream/main into rfx-blur-stylize

vangel7626798dce4205
diff --cc crates/gpu/src/effects.rs
index f73f47386,087c4961a..1e97b7eab
--- a/crates/gpu/src/effects.rs
+++ b/crates/gpu/src/effects.rs
@@@ -396,17 -384,19 +402,17 @@@ fn transform(e: &mut Enc, ctx: &EffectC
if ctx.env.host.is_some() && effectcraft_effects::transform_shutter(ctx).is_some() {
return None;
}
- let anchor = b.to_px(ctx.params.v2("anchor"));
- let pos = b.to_px(ctx.params.v2("position"));
- let sh = ctx.params.f("scaleHeight");
- let sw = if ctx.params.b("uniform") { sh } else { ctx.params.f("scaleWidth") };
let opacity = ctx.params.f("opacity") as f32 / 100.0;
- let m = Mat3::translate(vec2(pos.0, pos.1))
- * Mat3::rotate_deg(ctx.params.f("rotation"))
- * Mat3::skew_deg(ctx.params.f("skew"), ctx.params.f("skewAxis"))
- * Mat3::scale(vec2(sw / 100.0, sh / 100.0))
- * Mat3::translate(vec2(-anchor.0, -anchor.1));
+ // As distort::transform: After Effects' matrix, drawn outside the layer's bounds.
+ if !ctx.adjustment {
+ let m = effectcraft_effects::transform_matrix_px(ctx.params, |p| b.to_px(p));
+ let sides = effectcraft_effects::transform_grow(&[m], b.img.width, b.img.height);
+ b.pad_sides(e, sides)?;
+ }
+ let m = effectcraft_effects::transform_matrix_px(ctx.params, |p| b.to_px(p));
let sampling = if ctx.params.e("sampling") == 1 { Sampling::Bicubic } else { Sampling::Bilinear };
let empty = e.image(b.img.width, b.img.height);
- b.img = ops::warp(e, &empty, &b.img, &m, sampling, effectcraft_color::BlendMode::Normal, opacity, 0, None);
+ b.img = ops::warp(e, &empty, &b.img, &m, ops::WarpOptions { sampling, mode: effectcraft_color::BlendMode::Normal, opacity, seed: 0 }, None);
Some(b)
}
diff --cc crates/gpu/src/fx_stylize.rs
index 768fc3829,4b8ae787a..cc9045a41
--- a/crates/gpu/src/fx_stylize.rs
+++ b/crates/gpu/src/fx_stylize.rs
@@@ -988,10 -984,12 +988,10 @@@ pub(crate) fn transform(e: &mut Enc, ct
let (w, h) = (b.img.width, b.img.height);
let mut acc = e.image(w, h);
let mut count = 0u32;
- for k in 0..n {
- let t = ctx.time + (phase + angle * k as f64 / (n - 1) as f64) / 360.0 * fd;
- let Some(pr) = host.params_at(t) else { continue };
+ for pr in &samples {
let op = pr.f("opacity") as f32 / 100.0;
let empty = e.image(w, h);
- let one = ops::warp(e, &empty, &b.img, &transform_matrix(pr, &b), sampling, BlendMode::Normal, op, 0, None);
- let one = ops::warp(e, &empty, &b.img, &transform_matrix(&pr, &b), ops::WarpOptions { sampling, mode: BlendMode::Normal, opacity: op, seed: 0 }, None);
++ let one = ops::warp(e, &empty, &b.img, &transform_matrix(pr, &b), ops::WarpOptions { sampling, mode: BlendMode::Normal, opacity: op, seed: 0 }, None);
let sum = e.image(w, h);
e.pixels("fxs_add", &Params::default(), &acc, Some(&one), &sum, None);
acc = sum;