From 264a7dedd42e27cd9e604037640cf0594b2ec46b Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 19 Mar 2021 17:57:31 +0100 Subject: =?UTF-8?q?Scheduled=20maintenance=20=F0=9F=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - New naming scheme - TextNode instead of NodeText - CallExpr instead of ExprCall - ... - Less glob imports - Removes Value::Args variant - Removes prelude - Renames Layouted to Fragment - Moves font into env - Moves shaping into layout - Moves frame into separate module --- src/library/image.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/library/image.rs') diff --git a/src/library/image.rs b/src/library/image.rs index c3200e93..8cb09463 100644 --- a/src/library/image.rs +++ b/src/library/image.rs @@ -2,7 +2,9 @@ use ::image::GenericImageView; use super::*; use crate::env::{ImageResource, ResourceId}; -use crate::layout::*; +use crate::layout::{ + AnyNode, Areas, Element, Fragment, Frame, Image, Layout, LayoutContext, +}; /// `image`: Insert an image. /// @@ -13,7 +15,7 @@ use crate::layout::*; /// /// # Return value /// A template that inserts an image. -pub fn image(ctx: &mut EvalContext, args: &mut ValueArgs) -> Value { +pub fn image(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { let path = args.require::>(ctx, "path to image file"); let width = args.get(ctx, "width"); let height = args.get(ctx, "height"); @@ -53,7 +55,7 @@ struct NodeImage { } impl Layout for NodeImage { - fn layout(&self, _: &mut LayoutContext, areas: &Areas) -> Layouted { + fn layout(&self, _: &mut LayoutContext, areas: &Areas) -> Fragment { let Areas { current, full, .. } = areas; let pixel_width = self.dimensions.0 as f64; @@ -84,11 +86,11 @@ impl Layout for NodeImage { let mut frame = Frame::new(size); frame.push(Point::ZERO, Element::Image(Image { res: self.res, size })); - Layouted::Frame(frame, self.aligns) + Fragment::Frame(frame, self.aligns) } } -impl From for NodeAny { +impl From for AnyNode { fn from(image: NodeImage) -> Self { Self::new(image) } -- cgit v1.2.3