Skip to main content

apply_background_image

Function apply_background_image 

Source
pub fn apply_background_image(
    ent: &mut EntityWorldMut<'_>,
    tag: &str,
    attrs: &Attributes,
)
Expand description

Points an element’s background at the image its bg names, or takes a background image away when bg names a colour or a gradient instead.

The image travels the same road as an <image src>: an lumen_assets::ImageSource the asset pipeline resolves, decodes and caches, marked lumen_assets::BackgroundImage so it paints behind the content and never sizes the element. An <image> keeps its src as its one source, so a bg image on one is ignored.

attrs is the element’s whole resolved style: with no bg left, an image the element had is taken away, and with no bg-fit the image covers the box.