mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-07 23:00:35 +00:00
Merge pull request #5605 from dotCooCoo/fix/freeform-spot-warning
PDF export: freeform gradients without points warn about spot stops
This commit is contained in:
@@ -321,3 +321,19 @@ fn spot_gradients_drawn_as_images_warn() {
|
||||
assert!(pdf.contains("/Subtype/Image") && !pdf.contains("/Separation"), "a process Perceptual gradient");
|
||||
assert!(!spot_warning(&warnings), "{warnings:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn freeform_gradients_without_points_warn_about_spot_stops() {
|
||||
let (mut s, id) = setup();
|
||||
run(&mut s, "paint.editGradient", with(ink_to_white(100.0), json!({"kind": "freeform"})));
|
||||
// A freeform field with no points of its own: the colors come from the stops, the first
|
||||
// linked to the spot swatch.
|
||||
let mut g = gradient(&s, id);
|
||||
g.freeform = Some(vectorcraft_color::Freeform::default());
|
||||
g.gradient.stops[0].swatch = Some("Ink".into());
|
||||
let d = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc);
|
||||
d.node_mut(id).unwrap().appearance.set_fill(Paint::Gradient(Box::new(g)));
|
||||
let (pdf, warnings) = pdf_of(&s);
|
||||
assert!(pdf.contains("/Subtype/Image"), "an image");
|
||||
assert!(warnings.iter().any(|w| w.contains("spot colors in gradients exported as images")), "{warnings:?}");
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ impl Exporter<'_> {
|
||||
/// in process colors, so the spot inks have no plate of their own.
|
||||
fn warn_spot_image(&mut self, g: &vectorcraft_color::GradientPaint) {
|
||||
let doc = self.doc;
|
||||
let from_stops = g.gradient.kind != GradientKind::Freeform || g.freeform.is_none();
|
||||
let from_stops = g.gradient.kind != GradientKind::Freeform || !g.has_freeform_points();
|
||||
if from_stops && g.gradient.stops.iter().any(|s| s.swatch.as_deref().is_some_and(|n| doc.swatch(n).is_some_and(|w| w.spot))) {
|
||||
self.warn(
|
||||
"spot colors in gradients exported as images (freeform or dithered gradients, and Perceptual ones with RGB or Lab stops or too many stops) are written in process colors",
|
||||
|
||||
Reference in New Issue
Block a user