diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-07-20 14:51:24 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-20 12:51:24 +0000 |
| commit | 0c37a2c2334afb6947f265e00bded0fe75be6434 (patch) | |
| tree | c6dd66554f1f9cadc1f43f386639c05f3aa6bf3e /crates/typst-cli/src/compile.rs | |
| parent | 3aa18beacf84e8e982a1cb28170d281769c06dd0 (diff) | |
Support transparent page fill (#4586)
Co-authored-by: Martin Haug <mhaug@live.de>
Diffstat (limited to 'crates/typst-cli/src/compile.rs')
| -rw-r--r-- | crates/typst-cli/src/compile.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/crates/typst-cli/src/compile.rs b/crates/typst-cli/src/compile.rs index d1526425..cc85d920 100644 --- a/crates/typst-cli/src/compile.rs +++ b/crates/typst-cli/src/compile.rs @@ -10,10 +10,9 @@ use parking_lot::RwLock; use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; use typst::diag::{bail, Severity, SourceDiagnostic, StrResult, Warned}; use typst::foundations::{Datetime, Smart}; -use typst::layout::{Frame, PageRanges}; +use typst::layout::{Frame, Page, PageRanges}; use typst::model::Document; use typst::syntax::{FileId, Source, Span}; -use typst::visualize::Color; use typst::WorldExt; use crate::args::{ @@ -269,7 +268,7 @@ fn export_image( Output::Stdout => Output::Stdout, }; - export_image_page(command, &page.frame, &output, fmt)?; + export_image_page(command, page, &output, fmt)?; Ok(()) }) .collect::<Result<Vec<()>, EcoString>>()?; @@ -309,13 +308,13 @@ mod output_template { /// Export single image. fn export_image_page( command: &CompileCommand, - frame: &Frame, + page: &Page, output: &Output, fmt: ImageExportFormat, ) -> StrResult<()> { match fmt { ImageExportFormat::Png => { - let pixmap = typst_render::render(frame, command.ppi / 72.0, Color::WHITE); + let pixmap = typst_render::render(page, command.ppi / 72.0); let buf = pixmap .encode_png() .map_err(|err| eco_format!("failed to encode PNG file ({err})"))?; @@ -324,7 +323,7 @@ fn export_image_page( .map_err(|err| eco_format!("failed to write PNG file ({err})"))?; } ImageExportFormat::Svg => { - let svg = typst_svg::svg(frame); + let svg = typst_svg::svg(page); output .write(svg.as_bytes()) .map_err(|err| eco_format!("failed to write SVG file ({err})"))?; |
