Skip to main content

ImageBuilder

Trait ImageBuilder 

Source
pub trait ImageBuilder: Sized {
    // Required methods
    fn content_mode(self, m: ContentMode) -> Self;
    fn fit(self) -> Self;
    fn fill(self) -> Self;
    fn stretch(self) -> Self;
    fn aspect_ratio(self, ratio: f64) -> Self;
    fn decorative(self) -> Self;
    fn template(self) -> Self;
}
Expand description

Builder methods of Image, reachable through a Decorated (docs/api-style.md “Typed builders and erasure”): generic modifiers and typed ones chain in any order.

Required Methods§

Source

fn content_mode(self, m: ContentMode) -> Self

How the image scales within its frame (default ContentMode::Fit).

Source

fn fit(self) -> Self

Scale to fit entirely inside the frame, preserving aspect ratio (the default).

Source

fn fill(self) -> Self

Scale to fill the frame, preserving aspect ratio and cropping the overflow.

Source

fn stretch(self) -> Self

Stretch to fill the frame exactly, ignoring aspect ratio.

Source

fn aspect_ratio(self, ratio: f64) -> Self

Constrain the view to a width / height ratio (e.g. 16.0 / 9.0).

Source

fn decorative(self) -> Self

Mark the image decorative (hidden from accessibility).

Source

fn template(self) -> Self

Draw a monochrome glyph as a template (docs/vectors.md “Template”): in the foreground of the surface it sits on, following the theme, rather than in its authored colors. What a row icon in a sidebar wants; a photo does not.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl ImageBuilder for Image

Source§

impl<DecoratedInner: ImageBuilder + Piece> ImageBuilder for Decorated<DecoratedInner>

Day API ↩ Guides· daybrite.dev