summaryrefslogtreecommitdiff
path: root/crates/typst-pdf/src/content.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-07-20 14:51:24 +0200
committerGitHub <noreply@github.com>2024-07-20 12:51:24 +0000
commit0c37a2c2334afb6947f265e00bded0fe75be6434 (patch)
treec6dd66554f1f9cadc1f43f386639c05f3aa6bf3e /crates/typst-pdf/src/content.rs
parent3aa18beacf84e8e982a1cb28170d281769c06dd0 (diff)
Support transparent page fill (#4586)
Co-authored-by: Martin Haug <mhaug@live.de>
Diffstat (limited to 'crates/typst-pdf/src/content.rs')
-rw-r--r--crates/typst-pdf/src/content.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/typst-pdf/src/content.rs b/crates/typst-pdf/src/content.rs
index da9e4ed4..d9830e43 100644
--- a/crates/typst-pdf/src/content.rs
+++ b/crates/typst-pdf/src/content.rs
@@ -36,6 +36,7 @@ use crate::{deflate_deferred, AbsExt, EmExt};
pub fn build(
resources: &mut Resources<()>,
frame: &Frame,
+ fill: Option<Paint>,
color_glyph_width: Option<f32>,
) -> Encoded {
let size = frame.size();
@@ -53,6 +54,11 @@ pub fn build(
.post_concat(Transform::translate(Abs::zero(), size.y)),
);
+ if let Some(fill) = fill {
+ let shape = Geometry::Rect(frame.size()).filled(fill);
+ write_shape(&mut ctx, Point::zero(), &shape);
+ }
+
// Encode the frame into the content stream.
write_frame(&mut ctx, frame);