[][src]Crate embedded_layout

Enable simple layout operations in embedded-graphics

This crate extends embedded-graphics objects that implement the Transform trait to be aligned to other objects that have Dimensions.

Example

Draw some text to the center of the display:

use embedded_layout::prelude::*;
use embedded_graphics::{
    prelude::*,
    fonts::{Font6x8, Text},
    geometry::Point,
    primitives::Rectangle,
    pixelcolor::BinaryColor,
    style::TextStyleBuilder,
};

let display_area = disp.display_area();

let text_style = TextStyleBuilder::new(Font6x8)
                        .text_color(BinaryColor::On)
                        .build();

Text::new("Hello, world!", Point::zero())
     .into_styled(text_style)
     .align_to(display_area, horizontal::Center, vertical::Center)
     .draw(&mut disp)
     .unwrap();

Modules

horizontal

Horizontal alignment options

prelude

The essentials

vertical

Vertical alignment options

Traits

Align

This trait enables alignment operations of embedded-graphics primitives

DisplayArea

Helper trait to retrieve display area as a Rectangle.

HorizontalAlignment

Implement this trait for horizontal alignment algorithms

VerticalAlignment

Implement this trait for vertical alignment algorithms