M3.9: swatches in colour groups are first-class — Document Color Mode converts them, they can be spot colours with their own plate and PDF Separation, and Document Info counts them

Document::swatches_iter/_mut, swatch_mut, swatch_group_of, remove_swatch and a copy-on-write
walk over linked solid paints (map_solid_paints) cover every colour group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bflatastic
2026-10-04 12:15:10 +07:00
co-authored by Claude Opus 5.5
parent fb8c41d8e3
commit 00a0874d4d
9 changed files with 366 additions and 13 deletions
+1 -3
View File
@@ -215,9 +215,7 @@ impl Exporter<'_> {
/// swatch's CMYK equivalent is the alternate space).
fn solid(&mut self, c: &Color, swatch: Option<&str>) -> krilla::color::Color {
use krilla::color::separation::{Color as SepColor, SeparationColorant, SeparationSpace};
let spot = swatch
.and_then(|n| self.doc.swatches.iter().find(|s| s.spot && s.name == n))
.and_then(|s| s.paint.color().map(|sc| (s.name.clone(), sc)));
let spot = swatch.and_then(|n| self.doc.swatch(n).filter(|s| s.spot)).and_then(|s| s.paint.color().map(|sc| (s.name.clone(), sc)));
let Some((name, sc)) = spot else { return self.col(c) };
let cms = vectorcraft_color::cms::active();
let intent = cms.settings().intent;