diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-11-20 16:36:22 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-11-20 16:36:22 +0100 |
| commit | f105663037c44740b5aa02dea72a9b368bc003e0 (patch) | |
| tree | ee97638bfba2be3cfba8c1191919447262f181d0 /src/layout/mod.rs | |
| parent | 2e6e6244ccf73795d7d74cbc286fb0b43b404315 (diff) | |
Basic image support 🖼
- [image] function
- Image rendering in tests
- Supports JPEG and PNG
- No PDF export so far
Diffstat (limited to 'src/layout/mod.rs')
| -rw-r--r-- | src/layout/mod.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 4dd6184f..5586a1fd 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -2,6 +2,7 @@ mod document; mod fixed; +mod graphics; mod node; mod pad; mod par; @@ -9,12 +10,15 @@ mod spacing; mod stack; mod text; +use image::RgbaImage; + use crate::font::SharedFontLoader; use crate::geom::*; use crate::shaping::Shaped; pub use document::*; pub use fixed::*; +pub use graphics::*; pub use node::*; pub use pad::*; pub use par::*; @@ -179,4 +183,15 @@ impl BoxLayout { pub enum LayoutElement { /// Shaped text. Text(Shaped), + /// An image. + Image(ImageElement), +} + +/// An image. +#[derive(Debug, Clone, PartialEq)] +pub struct ImageElement { + /// The image. + pub buf: RgbaImage, + /// The document size of the image. + pub size: Size, } |
