diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-11-28 00:04:40 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-11-28 00:04:40 +0100 |
| commit | 21857064db8ca1bdf61b6e5ee37dff1a15083189 (patch) | |
| tree | d25041fb9c8086da0159f3aff90049ffa8d72f25 /tests | |
| parent | 982e7671a6c89ab189881b7b5c73aa18fee85a5f (diff) | |
Export alpha channel into PDF 🧊
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ref/image.png | bin | 952767 -> 299090 bytes | |||
| -rw-r--r-- | tests/res/tiger-alpha.png | bin | 0 -> 122035 bytes | |||
| -rw-r--r-- | tests/typ/image.typ | 11 | ||||
| -rw-r--r-- | tests/typeset.rs | 2 |
4 files changed, 7 insertions, 6 deletions
diff --git a/tests/ref/image.png b/tests/ref/image.png Binary files differindex 41fa6a9b..37349600 100644 --- a/tests/ref/image.png +++ b/tests/ref/image.png diff --git a/tests/res/tiger-alpha.png b/tests/res/tiger-alpha.png Binary files differnew file mode 100644 index 00000000..178b4b65 --- /dev/null +++ b/tests/res/tiger-alpha.png diff --git a/tests/typ/image.typ b/tests/typ/image.typ index ee82024f..0dd22950 100644 --- a/tests/typ/image.typ +++ b/tests/typ/image.typ @@ -1,14 +1,15 @@ -[page: width=10cm, height=10cm, margins=1cm] +[page: width=5cm, height=5cm, margins=0.25cm] [image: "res/tiger.jpg"] [pagebreak] # Tiger -[image: "res/tiger.jpg", width=3cm] -[image: "res/tiger.jpg", height=3cm] +[image: "res/tiger.jpg", width=2cm] +[image: "res/tiger-alpha.png", width=1cm] +[image: "res/tiger-alpha.png", height=2cm] [pagebreak] -[align: center] -[image: "res/tiger.jpg", width=6cm, height=6cm] +[align: center, bottom] +[image: "res/tiger.jpg", width=2cm, height=3.5cm] diff --git a/tests/typeset.rs b/tests/typeset.rs index 82d801a2..cc146fe4 100644 --- a/tests/typeset.rs +++ b/tests/typeset.rs @@ -248,7 +248,7 @@ fn draw_text(canvas: &mut Canvas, pos: Point, env: &Env, shaped: &Shaped) { } fn draw_image(canvas: &mut Canvas, pos: Point, env: &Env, image: &ImageElement) { - let buf = env.resources.get_loaded::<DynamicImage>(image.resource); + let buf = env.resources.get_loaded::<DynamicImage>(image.res); let mut pixmap = Pixmap::new(buf.width(), buf.height()).unwrap(); for ((_, _, src), dest) in buf.pixels().zip(pixmap.pixels_mut()) { |
