.ai save: Lab colors and type paints are written in the working RGB space

The reader reads the RGB values of plain colors, gradient stops and type
paints as working RGB. Lab colors (plain, in gradient stops and as the
full color of a spot stop), type's RGB and Lab fills and strokes in the
text document, and the average color written for a freeform gradient, a
gradient along a stroke or a gradient that can't be placed were written
as display sRGB. With a working RGB space other than sRGB, a reopened
file showed different colors. They are now converted into the working
RGB space, and type's RGB paints keep their own values. The legacy
writer's Lab inks and freeform fills get the same conversion.

A Lab color outside sRGB is clipped to sRGB before the conversion, as
Cms::from_lab does.
This commit is contained in:
dotCooCoo
2026-11-13 11:38:51 -08:00
parent 630ef6f549
commit 06e02f3fd8
7 changed files with 314 additions and 15 deletions
+240
View File
@@ -386,6 +386,246 @@ fn rgb_values_are_written_again_unchanged_in_a_wide_gamut_working_space() {
same_lines(&again.lines().map(String::from).collect::<Vec<_>>(), &first.lines().map(String::from).collect::<Vec<_>>());
}
/// With a working RGB space other than sRGB, type's RGB fill and stroke are written in the text
/// document with their working RGB values, so they read back as the same colors.
#[test]
fn type_rgb_paints_read_back_unchanged_in_a_wide_gamut_working_space() {
const CHILD: &str = "VECTORCRAFT_TEST_AI_EDITING_WIDE_GAMUT_TYPE";
if std::env::var_os(CHILD).is_none() {
// Color settings are process-wide: exercise this profile in a separate test process.
let output = std::process::Command::new(std::env::current_exe().unwrap())
.args(["--exact", "ai_editing::tests::type_rgb_paints_read_back_unchanged_in_a_wide_gamut_working_space", "--nocapture"])
.env(CHILD, "1")
.output()
.unwrap();
let stdout = String::from_utf8_lossy(&output.stdout);
assert!(
output.status.success() && stdout.contains("test result: ok. 1 passed; 0 failed;"),
"isolated color profile test failed:\n{stdout}\n{}",
String::from_utf8_lossy(&output.stderr),
);
return;
}
use vectorcraft_color::cms;
use vectorcraft_doc::{CharStyle, TextObject};
cms::set_active(&cms::ColorSettings { rgb: cms::WIDE_GAMUT_RGB.into(), ..Default::default() }).unwrap();
assert!(!cms::active().rgb_is_srgb());
let mut doc = Document::new(300.0, 200.0);
let layer = doc.layers[0].id;
let (fill, stroke) = (Color::rgb(0.8, 0.4, 0.2), Color::rgb(0.1, 0.7, 0.3));
let st = CharStyle { stroke: solid(stroke), stroke_width: 1.0, ..style(14.0, fill) };
let n = text_node(&mut doc, TextObject::point(vectorcraft_geom::Point::new(20.0, 40.0), "Wide", st));
doc.insert(Some(layer), usize::MAX, n).unwrap();
let back = read_back(&doc);
let paints: Vec<(Paint, Paint)> = back.layers[0]
.children()
.unwrap()
.iter()
.filter_map(|n| if let NodeKind::Text(t) = &n.kind { Some(t) } else { None })
.flat_map(|t| t.runs.iter().map(|r| (r.style.fill.clone(), r.style.stroke.clone())))
.collect();
assert!(!paints.is_empty(), "the type is read back as type");
let near = |p: &Paint, want: Color| match (p, want) {
(Paint::Solid { color: Color::Rgb { r, g, b }, .. }, Color::Rgb { r: wr, g: wg, b: wb }) => {
(r - wr).abs() < 1e-4 && (g - wg).abs() < 1e-4 && (b - wb).abs() < 1e-4
}
_ => false,
};
for (f, s) in &paints {
assert!(near(f, fill), "fill {f:?} reads back as {fill:?}");
assert!(near(s, stroke), "stroke {s:?} reads back as {stroke:?}");
}
}
/// With a working RGB space other than sRGB, a Lab fill, a Lab gradient stop, type filled with a
/// Lab color and a freeform gradient's average color are written as RGB values in the working RGB
/// space, so they read back as RGB colors that show as the colors they were written for.
#[test]
fn lab_paints_read_back_as_the_same_color_in_a_wide_gamut_working_space() {
const CHILD: &str = "VECTORCRAFT_TEST_AI_EDITING_WIDE_GAMUT_LAB";
if std::env::var_os(CHILD).is_none() {
// Color settings are process-wide: exercise this profile in a separate test process.
let output = std::process::Command::new(std::env::current_exe().unwrap())
.args(["--exact", "ai_editing::tests::lab_paints_read_back_as_the_same_color_in_a_wide_gamut_working_space", "--nocapture"])
.env(CHILD, "1")
.output()
.unwrap();
let stdout = String::from_utf8_lossy(&output.stdout);
assert!(
output.status.success() && stdout.contains("test result: ok. 1 passed; 0 failed;"),
"isolated color profile test failed:\n{stdout}\n{}",
String::from_utf8_lossy(&output.stderr),
);
return;
}
use vectorcraft_color::cms;
use vectorcraft_doc::TextObject;
cms::set_active(&cms::ColorSettings { rgb: cms::WIDE_GAMUT_RGB.into(), ..Default::default() }).unwrap();
assert!(!cms::active().rgb_is_srgb());
let (fill, stop, ink) = (Color::lab(60.0, 20.0, -30.0), Color::lab(45.0, -25.0, 15.0), Color::lab(70.0, 10.0, 40.0));
let mut doc = Document::new(300.0, 200.0);
let layer = doc.layers[0].id;
let n = square(&mut doc, Rect::new(10.0, 10.0, 30.0, 30.0), fill);
doc.insert(Some(layer), usize::MAX, n).unwrap();
let stops = vec![GradientStop::new(0.0, Color::rgb(0.1, 0.7, 0.3)), GradientStop::new(1.0, stop)];
let paint = gradient_paint(Gradient::new(GradientKind::Linear, stops), None, None);
let n = painted(&mut doc, shapes::rectangle(Rect::new(40.0, 10.0, 60.0, 30.0)), vec![AppearanceItem::Fill(FillLayer::new(paint))]);
doc.insert(Some(layer), usize::MAX, n).unwrap();
let n = text_node(&mut doc, TextObject::point(vectorcraft_geom::Point::new(20.0, 80.0), "Lab", style(14.0, ink)));
doc.insert(Some(layer), usize::MAX, n).unwrap();
// A freeform gradient is written as the average of its stops' display colors.
let (a, b) = (Color::rgb(0.9, 0.2, 0.1), Color::lab(50.0, -40.0, -20.0));
let free = ramp(GradientKind::Freeform, &[(0.0, a, 1.0, 0.5), (1.0, b, 1.0, 0.5)]);
let n = painted(
&mut doc,
shapes::rectangle(Rect::new(70.0, 10.0, 90.0, 30.0)),
vec![AppearanceItem::Fill(FillLayer::new(gradient_paint(free, None, None)))],
);
doc.insert(Some(layer), usize::MAX, n).unwrap();
let average = {
let (a, b) = (a.to_rgb(), b.to_rgb());
[0, 1, 2].map(|i| (a[i] + b[i]) / 2.0)
};
let back = read_back(&doc);
let shows_as = |got: Color, want: [f32; 3], what: &str| {
assert!(matches!(got, Color::Rgb { .. }), "{what} reads back as RGB: {got:?}");
let g = got.to_rgb();
assert!(g.iter().zip(want).all(|(a, b)| (a - b).abs() < 2e-3), "{what} {got:?} shows as {g:?}, not {want:?}");
};
let mut solids = vec![(fill.to_rgb(), "fill"), (average, "freeform gradient's average")].into_iter();
let (mut stops, mut runs) = (0, 0);
for n in back.layers[0].children().unwrap() {
match (&n.kind, n.appearance.fill_paint()) {
(NodeKind::Text(t), _) => {
for r in &t.runs {
let Paint::Solid { color, .. } = r.style.fill else { panic!("type fill {:?}", r.style.fill) };
shows_as(color, ink.to_rgb(), "type fill");
runs += 1;
}
}
(_, Paint::Solid { color, .. }) => {
let Some((want, what)) = solids.next() else { panic!("unexpected solid {color:?}") };
shows_as(color, want, what);
}
(_, Paint::Gradient(g)) => {
let last = g.gradient.stops.last().unwrap();
shows_as(last.color, stop.to_rgb(), "gradient stop");
stops += 1;
}
(_, p) => panic!("unexpected paint {p:?}"),
}
}
assert_eq!((solids.len(), stops), (0, 1));
assert!(runs > 0, "the type is read back as type");
}
/// With a working RGB space other than sRGB, the average color written for a gradient along a
/// stroke and for a gradient that can't be placed, a stop of a spot color defined in Lab and type
/// stroked with a Lab color are written as RGB values in the working RGB space, so each reads back
/// as an RGB color that shows as the color it was written for.
#[test]
fn averages_lab_spot_stops_and_lab_type_strokes_read_back_as_the_same_color_in_a_wide_gamut_working_space() {
const CHILD: &str = "VECTORCRAFT_TEST_AI_EDITING_WIDE_GAMUT_AVERAGES";
if std::env::var_os(CHILD).is_none() {
// Color settings are process-wide: exercise this profile in a separate test process.
let output = std::process::Command::new(std::env::current_exe().unwrap())
.args([
"--exact",
"ai_editing::tests::averages_lab_spot_stops_and_lab_type_strokes_read_back_as_the_same_color_in_a_wide_gamut_working_space",
"--nocapture",
])
.env(CHILD, "1")
.output()
.unwrap();
let stdout = String::from_utf8_lossy(&output.stdout);
assert!(
output.status.success() && stdout.contains("test result: ok. 1 passed; 0 failed;"),
"isolated color profile test failed:\n{stdout}\n{}",
String::from_utf8_lossy(&output.stderr),
);
return;
}
use vectorcraft_color::cms;
use vectorcraft_color::gradient::GradientGeom;
use vectorcraft_doc::{CharStyle, TextObject};
cms::set_active(&cms::ColorSettings { rgb: cms::WIDE_GAMUT_RGB.into(), ..Default::default() }).unwrap();
assert!(!cms::active().rgb_is_srgb());
let shows_as = |got: Color, want: [f32; 3], what: &str| {
assert!(matches!(got, Color::Rgb { .. }), "{what} reads back as RGB: {got:?}");
let g = got.to_rgb();
assert!(g.iter().zip(want).all(|(a, b)| (a - b).abs() < 2e-3), "{what} {got:?} shows as {g:?}, not {want:?}");
};
let (a, b) = (Color::rgb(0.9, 0.2, 0.1), Color::lab(50.0, -40.0, -20.0));
let average = {
let (a, b) = (a.to_rgb(), b.to_rgb());
[0, 1, 2].map(|i| (a[i] + b[i]) / 2.0)
};
// Every solid paint of the art read back, in order.
let solids = |doc: &Document| {
let mut out = vec![];
read_back(doc).walk(|n| {
if matches!(n.kind, NodeKind::Path { .. } | NodeKind::Compound { .. }) {
out.extend(n.appearance.items.iter().filter_map(|i| match i.paint() {
Paint::Solid { color, .. } => Some(*color),
_ => None,
}));
}
});
out
};
// A gradient along a stroke: the stroke's outline in its average color.
let mut doc = Document::new(200.0, 100.0);
let layer = doc.layers[0].id;
let mut st = StrokeLayer::new(gradient_paint(ramp(GradientKind::Linear, &[(0.0, a, 1.0, 0.5), (1.0, b, 1.0, 0.5)]), None, None), 4.0);
st.gradient_mode = vectorcraft_doc::StrokeGradientMode::Along;
let n = painted(&mut doc, shapes::rectangle(Rect::new(10.0, 10.0, 30.0, 30.0)), vec![AppearanceItem::Stroke(st)]);
doc.insert(Some(layer), usize::MAX, n).unwrap();
let [got] = solids(&doc)[..] else { panic!("one solid paint: {:?}", solids(&doc)) };
shows_as(got, average, "a gradient along a stroke");
// A radial gradient flattened to a line: its average color.
let flat = GradientGeom { start: (20.0, 20.0).into(), end: (40.0, 20.0).into(), aspect: 0.0, focal: None };
let radial = ramp(GradientKind::Radial, &[(0.0, a, 1.0, 0.5), (1.0, b, 1.0, 0.5)]);
let doc = one_object(
shapes::rectangle(Rect::new(10.0, 10.0, 50.0, 50.0)),
vec![AppearanceItem::Fill(FillLayer::new(gradient_paint(radial, Some(flat), None)))],
);
let [got] = solids(&doc)[..] else { panic!("one solid paint: {:?}", solids(&doc)) };
shows_as(got, average, "a gradient that can't be placed");
// A stop of a spot color defined in Lab, at full strength.
let moss = Color::lab(55.0, -30.0, 20.0);
let mut doc = Document::new(200.0, 100.0);
let mut swatches: Vec<Swatch> = doc.swatches.iter().cloned().collect();
swatches.push(Swatch { name: "Moss".into(), paint: solid(moss), global: true, spot: true });
doc.swatches = swatches.into();
let layer = doc.layers[0].id;
let stops = vec![GradientStop::new(0.0, Color::rgb(0.1, 0.2, 0.3)), GradientStop { swatch: Some("Moss".into()), ..GradientStop::new(1.0, moss) }];
let fill = gradient_paint(Gradient::new(GradientKind::Linear, stops), None, None);
let n = painted(&mut doc, shapes::rectangle(Rect::new(10.0, 10.0, 30.0, 30.0)), vec![AppearanceItem::Fill(FillLayer::new(fill))]);
doc.insert(Some(layer), usize::MAX, n).unwrap();
let back = read_back(&doc);
let Paint::Gradient(g) = back.layers[0].children().unwrap()[0].appearance.fill_paint() else { panic!("a gradient") };
shows_as(g.gradient.stops.last().unwrap().color, moss.to_rgb(), "a Lab spot color's stop");
// Type stroked with a Lab color.
let ink = Color::lab(40.0, 30.0, -50.0);
let mut doc = Document::new(200.0, 100.0);
let layer = doc.layers[0].id;
let st = CharStyle { stroke: solid(ink), stroke_width: 1.0, ..style(14.0, Color::rgb(0.8, 0.4, 0.2)) };
let n = text_node(&mut doc, TextObject::point(vectorcraft_geom::Point::new(20.0, 40.0), "Lab", st));
doc.insert(Some(layer), usize::MAX, n).unwrap();
let back = read_back(&doc);
let mut runs = 0;
for n in back.layers[0].children().unwrap() {
if let NodeKind::Text(t) = &n.kind {
for r in &t.runs {
let Paint::Solid { color, .. } = r.style.stroke else { panic!("type stroke {:?}", r.style.stroke) };
shows_as(color, ink.to_rgb(), "type stroke");
runs += 1;
}
}
}
assert!(runs > 0, "the type is read back as type");
}
/// A gradient stop of a Lab spot color writes the RGB values of the Lab values as written (to four
/// decimals, clamped to the range a reader reads), the same Lab values its CMYK equivalent and the
/// palette's definition come from: for Lab values of many decimals and for Lab values out of range.
+2 -2
View File
@@ -1378,8 +1378,8 @@ impl<'a> Writer<'a> {
self.plain_color(*color, stroke);
}
/// A color that names no swatch: `g` (gray), `k` (CMYK), else `c m y k r g b Xa` (RGB in the
/// working RGB space, and Lab as display RGB), with its CMYK equivalent (an RGB color's from its
/// A color that names no swatch: `g` (gray), `k` (CMYK), else `c m y k r g b Xa` (RGB, and Lab
/// as RGB, in the working RGB space), with its CMYK equivalent (an RGB color's from its
/// values as written, a Lab color's from its Lab values).
fn plain_color(&mut self, color: Color, stroke: bool) {
let s = &mut self.body;
+2 -2
View File
@@ -391,8 +391,8 @@ impl Writer<'_> {
/// A stop's color and its style: gray `lightness 0`, CMYK `c m y k 1`, RGB (and Lab, as RGB)
/// `c m y k r g b 2` with its CMYK equivalent; a spot color its full color's CMYK equivalent,
/// then its RGB values when it isn't CMYK, its name and how much lighter than the full color,
/// then `3` (CMYK), or `1 4` (RGB, and Lab as RGB). RGB values are an RGB color's own (in the
/// working RGB space) and a Lab color's display RGB ([`ai_ops::rgb_values`]). An RGB color's CMYK
/// then `3` (CMYK), or `1 4` (RGB, and Lab as RGB). RGB values are in the working RGB space: an
/// RGB color's own and a Lab color's converted ([`ai_ops::rgb_values`]). An RGB color's CMYK
/// equivalent is converted from its values as written ([`ai_ops::as_written`]), a Lab color's
/// from its Lab values, and a spot color's CMYK equivalent and RGB values both come from its full
/// color as the palette writes it.
+4 -2
View File
@@ -26,7 +26,7 @@ use vectorcraft_doc::{
};
use vectorcraft_geom::{Affine, PathData, Point};
use crate::ps;
use crate::{ai_ops, ps};
/// What the text document holds of type, and what it leaves out.
pub(in crate::ai_editing) const TYPE_ATTRIBUTES: &str = "attributes of type other than its font, size, leading, tracking, baseline shift, horizontal and vertical scale, solid fill, solid stroke and its weight, cap, join and miter limit, capitals, small capitals at the document's size, Tate-chu-yoko, Standard Vertical Roman Alignment, paragraph alignment, indents, space before and after, hyphenation on or off and right-to-left direction (for example underline, kerning, OpenType features, swatch links of its colors, character and paragraph styles, tabs, lists, optical margin alignment, area type's inset spacing, vertical alignment and flow, a minimum first baseline with the Ascent first baseline, and type on a path's effect, alignment and spacing and an end bracket at the very end of an open path) are left out of the editing data for other apps";
@@ -170,11 +170,13 @@ fn set(resources: Vec<V>, display: bool) -> V {
}
/// A paint: kind 0 gray (`[alpha, lightness]`), 1 RGB, 2 CMYK, as the reader's `paint` reads them.
/// RGB values are an RGB color's own (in the working RGB space) and a Lab color's converted into
/// the working RGB space ([`ai_ops::rgb_values`]).
fn paint(c: &Color) -> V {
let (kind, values) = match *c {
Color::Gray { k } => (0, vec![1.0 - f64::from(k.clamp(0.0, 1.0))]),
Color::Cmyk { c, m, y, k } => (2, [c, m, y, k].iter().map(|v| f64::from(v.clamp(0.0, 1.0))).collect()),
Color::Rgb { .. } | Color::Lab { .. } => (1, c.to_rgb().iter().map(|v| f64::from(v.clamp(0.0, 1.0))).collect()),
Color::Rgb { .. } | Color::Lab { .. } => (1, ai_ops::rgb_values(*c).iter().map(|v| f64::from(*v)).collect()),
};
let values: Vec<f64> = std::iter::once(1.0).chain(values).collect();
dict(vec![(99, V::Name("SimplePaint")), (0, dict(vec![(0, V::Int(kind)), (1, reals(&values))]))])
+8 -5
View File
@@ -115,20 +115,23 @@ pub(crate) fn as_written(color: Color) -> Color {
}
}
/// The RGB values written for `color`, clamped to 0..1: an RGB color's own values (in the working
/// RGB space, as a reader reads them back), any other color's display RGB.
/// The RGB values written for `color`, clamped to 0..1, in the working RGB space, as a reader
/// reads them back: an RGB color's own values, any other color's display RGB converted into the
/// working RGB space.
pub(crate) fn rgb_values(color: Color) -> [f32; 3] {
match color {
Color::Rgb { r, g, b } => [r, g, b].map(unit),
c => c.to_rgb().map(unit),
c => vectorcraft_color::cms::active().srgb_to_rgb(c.to_rgb()).map(unit),
}
}
/// The average colour of a gradient's stops (in RGB).
/// The average color of a gradient's stops: the average of their display RGB, as an RGB color in
/// the working RGB space.
pub(crate) fn average(g: &Gradient) -> Color {
let n = g.stops.len().max(1) as f32;
let sum = g.stops.iter().map(|s| s.color.to_rgb()).fold([0.0f32; 3], |a, c| [a[0] + c[0], a[1] + c[1], a[2] + c[2]]);
Color::rgb(unit(sum[0] / n), unit(sum[1] / n), unit(sum[2] / n))
let [r, green, b] = vectorcraft_color::cms::active().srgb_to_rgb(sum.map(|v| v / n)).map(unit);
Color::rgb(r, green, b)
}
/// The stroke's width, cap, join, miter limit and dashes: `w J j M d`.
+57
View File
@@ -817,6 +817,63 @@ fn rgb_stops_are_written_again_unchanged() {
assert_eq!(again, first);
}
/// With a working RGB space other than sRGB, a Lab fill and a freeform gradient's average color
/// are written as RGB values in the working RGB space, so they read back as RGB colors that show as
/// the colors they were written for.
#[test]
fn a_lab_fill_reads_back_as_the_same_color_in_a_wide_gamut_working_space() {
const CHILD: &str = "VECTORCRAFT_TEST_LEGACY_AI_WIDE_GAMUT_LAB";
if std::env::var_os(CHILD).is_none() {
// Color settings are process-wide: exercise this profile in a separate test process.
let output = std::process::Command::new(std::env::current_exe().unwrap())
.args(["--exact", "legacy_ai::tests::a_lab_fill_reads_back_as_the_same_color_in_a_wide_gamut_working_space", "--nocapture"])
.env(CHILD, "1")
.output()
.unwrap();
let stdout = String::from_utf8_lossy(&output.stdout);
assert!(
output.status.success() && stdout.contains("test result: ok. 1 passed; 0 failed;"),
"isolated color profile test failed:\n{stdout}\n{}",
String::from_utf8_lossy(&output.stderr),
);
return;
}
use vectorcraft_color::cms;
cms::set_active(&cms::ColorSettings { rgb: cms::WIDE_GAMUT_RGB.into(), ..Default::default() }).unwrap();
assert!(!cms::active().rgb_is_srgb());
let lab = Color::lab(60.0, 20.0, -30.0);
let mut doc = Document::new(100.0, 100.0);
let n = shape(&mut doc, shapes::rectangle(Rect::new(10.0, 10.0, 50.0, 50.0)), Paint::solid(lab), Paint::None);
let layer = doc.layers[0].id;
doc.insert(Some(layer), usize::MAX, n).unwrap();
// A freeform gradient is written as the average of its stops' display colors.
let (a, b) = (Color::rgb(0.9, 0.2, 0.1), Color::lab(50.0, -40.0, -20.0));
let stops = vec![GradientStop::new(0.0, a), GradientStop::new(1.0, b)];
let free = Paint::Gradient(Box::new(GradientPaint::new(Gradient::new(GradientKind::Freeform, stops))));
let n = shape(&mut doc, shapes::rectangle(Rect::new(60.0, 10.0, 90.0, 50.0)), free, Paint::None);
doc.insert(Some(layer), usize::MAX, n).unwrap();
let average = {
let (a, b) = (a.to_rgb(), b.to_rgb());
[0, 1, 2].map(|i| (a[i] + b[i]) / 2.0)
};
// Written without [`write`]'s printed comparison, which paints a gradient in its first stop's
// color and not in the average color the writer writes for a freeform gradient.
let back = crate::import(&export_legacy_ai(&doc, &LegacyAiOptions::default()).unwrap().bytes).unwrap().document;
let mut read = vec![];
back.walk(|n| {
if let NodeKind::Path { .. } = n.kind {
read.push(n.appearance.fill_paint());
}
});
let [Paint::Solid { color: got @ Color::Rgb { .. }, .. }, Paint::Solid { color: avg @ Color::Rgb { .. }, .. }] = read.as_slice() else {
panic!("two RGB fills: {read:?}")
};
for (got, w, what) in [(got, lab.to_rgb(), "Lab fill"), (avg, average, "freeform gradient's average")] {
let g = got.to_rgb();
assert!(g.iter().zip(w).all(|(a, b)| (a - b).abs() < 2e-3), "{what} {got:?} shows as {g:?}, not {w:?}");
}
}
/// A gradient from white to #1b2a6b, the colors of #2687's circle, placed at `geom` (None: fitted
/// to the object).
fn white_to_navy(kind: GradientKind, geom: Option<vectorcraft_color::GradientGeom>) -> Paint {
+1 -4
View File
@@ -648,10 +648,7 @@ impl<'a> Writer<'a> {
Color::Cmyk { c, m, y, k } => Ink::Cmyk([c, m, y, k].map(unit)),
// The CMYK equivalent of the RGB values as written.
Color::Rgb { r, g, b } => Ink::Rgb(self.cms.to_cmyk(&ai_ops::as_written(*color), intent).map(unit), [r, g, b].map(unit)),
Color::Lab { .. } => {
let rgb = color.to_rgb().map(unit);
Ink::Rgb(self.cms.to_cmyk(color, intent).map(unit), rgb)
}
Color::Lab { .. } => Ink::Rgb(self.cms.to_cmyk(color, intent).map(unit), ai_ops::rgb_values(*color)),
}
}