padding

Function padding 

Source
pub fn padding<C: PixelColor, L: Layoutable<C>>(
    layoutable: L,
    top: i32,
    right: i32,
    bottom: i32,
    left: i32,
) -> impl Layoutable<C>
Expand description

Adjust placement of a component by adding/removing additional offsets

§Arguments

  • layoutable: element to place
  • top: adjustment to the top
  • right: adjustment on the right
  • bottom: adjustment to the bottom
  • left: adjustment on the left

returns: impl Layoutable+Sized

§Examples

use embedded_graphics::geometry::Point;
use embedded_graphics::mono_font::iso_8859_1::FONT_6X12;
use embedded_graphics::mono_font::MonoTextStyle;
use embedded_graphics::pixelcolor::BinaryColor;
use embedded_graphics::text::Text;
use simple_layout::prelude::padding;
let adjusted_text = padding(Text::new("-", Point::zero(), MonoTextStyle::new(&FONT_6X12, BinaryColor::On)), -2, 1, -1, 1);