Integration: #1451 screened outer glows and blended shadows isolate the spread from the paper

This commit is contained in:
aiongg committed 2026-10-31 00:35:26 +00:00
1 parent e040354eb4
commit 7d16fffb39
2 files changed
+22 -1

No files matched your search

+5 -1
View File
@@ -202,7 +202,11 @@ pub(crate) fn overprints(f: &Frame, swatch: &str, tint: f32, flag: bool) -> bool
pub(crate) fn spread_blends(doc: &Document, sp: &designcraft_doc::Spread) -> bool {
let blends = |it: &Item| {
let mut any = false;
it.walk(&mut |i| any |= i.blend != Default::default());
// A screened glow or a shadow with a blend mode blends with the objects below too, not the paper.
let fx_blends = |e: &designcraft_doc::Effects| {
(e.outer_glow.on && e.outer_glow.mode != Default::default()) || (e.drop_shadow.on && e.drop_shadow.mode != Default::default())
};
it.walk(&mut |i| any |= i.blend != Default::default() || fx_blends(&i.effects));
any
};
sp.items.iter().any(|i| blends(i)) || doc.parents.iter().any(|p| p.items.iter().any(|i| blends(i)))
+17
View File
@@ -178,6 +178,23 @@ fn outer_glow_blends_with_its_mode() {
assert!(s[2] > n[2] + 25, "screen keeps the backdrop's blue: {s:?} vs normal {n:?}");
}
/// A screened glow over blank paper shows in its colour: it blends with the objects below, and
/// the paper is not one of them.
#[test]
fn screened_outer_glow_shows_on_blank_paper() {
let mut d = doc();
let id = rect_item(&mut d, Rect::new(50.0, 50.0, 110.0, 110.0), "[Black]");
let g = &mut d.item_mut(id).unwrap().effects.outer_glow;
g.on = true;
g.size = 12.0;
g.color = "C=0 M=0 Y=100 K=0".into();
g.opacity = 1.0;
g.mode = designcraft_color::BlendMode::Screen;
let img = render(&d);
let p = img.pixel(46, 80);
assert!(p[2] < 200 && p[0] > p[2] + 40, "yellow glow beside the item: {p:?}");
}
#[test]
fn inner_shadow_darkens_inside_the_lit_edge() {
let mut d = doc();