summaryrefslogtreecommitdiff
path: root/crates/typst-pdf/src/gradient.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-10-01 11:24:18 +0200
committerGitHub <noreply@github.com>2024-10-01 09:24:18 +0000
commita0093ad8a7906068b4bd641c28f614804d3e099d (patch)
tree85110d3e95b08c119cfe37fc3d7014511e41a453 /crates/typst-pdf/src/gradient.rs
parent8eee3ec8d1b4d960017cb558887bd6180cc99cea (diff)
Minimal PDF/A support (#5075)
Co-authored-by: Martin Haug <mhaug@live.de>
Diffstat (limited to 'crates/typst-pdf/src/gradient.rs')
-rw-r--r--crates/typst-pdf/src/gradient.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/typst-pdf/src/gradient.rs b/crates/typst-pdf/src/gradient.rs
index 2cfd480b..be0a3ea0 100644
--- a/crates/typst-pdf/src/gradient.rs
+++ b/crates/typst-pdf/src/gradient.rs
@@ -13,7 +13,9 @@ use typst::visualize::{
Color, ColorSpace, Gradient, RatioOrAngle, RelativeTo, WeightedColor,
};
-use crate::color::{self, ColorSpaceExt, PaintEncode, QuantizedColor};
+use crate::color::{
+ self, check_cmyk_allowed, ColorSpaceExt, PaintEncode, QuantizedColor,
+};
use crate::{content, WithGlobalRefs};
use crate::{deflate, transform_to_array, AbsExt, PdfChunk};
@@ -56,6 +58,10 @@ pub fn write_gradients(
gradient.space()
};
+ if color_space == ColorSpace::Cmyk {
+ check_cmyk_allowed(context.options)?;
+ }
+
let mut shading_pattern = match &gradient {
Gradient::Linear(_) => {
let shading_function =