mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-31 05:07:51 -06:00
Gradients: an outlined stroke leaves dither behind, and paint.setStroke refuses it
Review follow-up (CodeRabbit): paint.setStroke kept `dither: true` from its gradient, and a stroke can hold dither anyway (swapped from a fill). Outline Stroke and appearance expansion copied the stroke's paint into the outline's fill, which then drew dithered although the stroke never did. The outline's fill now goes without dither (Paint::stroke_as_fill), and paint.setStroke refuses a gradient with `dither: true`, as paint.editGradient does.
This commit is contained in:
committed by
bflatastic
parent
159e20053c
commit
7c9edfaf7f
@@ -403,6 +403,10 @@ fn set_paint(s: &mut Session, p: &Value, fill: bool) -> Result<Value> {
|
||||
}
|
||||
check_keep_model(p, cmd)?;
|
||||
let paint = paint_from(s, p)?.ok_or_else(|| bad(cmd, "give color, none, swatch or gradient"))?;
|
||||
// As `paint.editGradient`: a `dither` given applies to gradient fills only.
|
||||
if !fill && matches!(&paint, Paint::Gradient(g) if g.gradient.dither) && p.get("swatch").is_none() {
|
||||
return Err(bad(cmd, "`dither` applies to gradient fills (paint.setFill)"));
|
||||
}
|
||||
apply_paint(s, p, paint, fill)
|
||||
}
|
||||
|
||||
|
||||
@@ -635,7 +635,7 @@ pub(crate) fn outlined_stroke(
|
||||
blend: st.blend,
|
||||
effects: st.effects.clone(),
|
||||
overprint: st.overprint,
|
||||
..vectorcraft_doc::appearance::FillLayer::new(st.paint.clone())
|
||||
..vectorcraft_doc::appearance::FillLayer::new(st.paint.stroke_as_fill())
|
||||
};
|
||||
n.appearance = Appearance { items: vec![AppearanceItem::Fill(fill)], ..Default::default() }.into();
|
||||
Some(n)
|
||||
|
||||
Reference in New Issue
Block a user