Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Integration: merge main (#5937)

David Mannf9efad49d62b
diff --cc crates/compose/src/effects.rs
index 550cb398a,264dc3529..cc24e479c
--- a/crates/compose/src/effects.rs
+++ b/crates/compose/src/effects.rs
@@@ -2093,9 -2234,29 +2234,14 @@@ pub(crate) fn composite_with_effects_pr
let mut share = vec![0.0f32; w * h];
for (i, sh) in share.iter_mut().enumerate() {
let band = (out_w + 0.5 - d[i]).clamp(0.0, 1.0);
- let k = if maps.outline {
- band * outline_share(shape.v[i], lay.px[i][3])
- } else if inside(shape.v[i]) {
- if vector_shape {
- 0.0
- } else {
- // The stroke lies outside the layer's pixels. Beneath the layer it may show
- // only through the part of the pixel the shape doesn't cover (1 - a); the
- // layer composited on top covers c = a × fill, so the share beneath is
- // (1 - a) / (1 - c). At 100 % fill that is 1 (the layer hides the rest, as
- // before); at 0 % fill the interior stays clear (Fill 0 % + Outside stroke).
- let c = lay.px[i][3].clamp(0.0, 1.0);
- if c >= 1.0 { 1.0 } else { ((1.0 - shape.v[i].clamp(0.0, 1.0)) / (1.0 - c)).clamp(0.0, 1.0) }
- }
- } else {
- band
- };
+ let k =
+ if inside(shape.v[i]) { if vector_shape && !maps.outline { 0.0 } else { band * outline_share(shape.v[i], lay.px[i][3]) } } else { band };
- *sh = k * st.common.opacity * (1.0 - cover[i]);
+ let mut k = k * st.common.opacity;
+ if st.common.blend == BlendMode::Dissolve {
+ let (x, y) = (i64::from(big.x0) + (i % w) as i64, i64::from(big.y0) + (i / w) as i64);
+ k = if k > 0.0 && dissolves_in(x, y, k) { 1.0 } else { 0.0 };
+ }
+ *sh = k * (1.0 - cover[i]);
cover[i] += *sh;
}
// The stroke blended over the backdrop at full coverage.