Skip to main content

Module background_image

Module background_image 

Source
Expand description

The backgroundImage style wire types and their totalizing decoder.

Structs§

AtlasSpec
A uniform sprite-sheet grid plus the selected cell. Mirrors TextureAtlasLayout::from_grid (tile size, columns, rows, optional padding / offset, all in source-texture pixels) + TextureAtlas.index. Bevy-free; turned into a cached TextureAtlasLayout asset in ui_map.
BackgroundImageSpec
The decoded backgroundImage style object. Deliberately NOT ImageMode: that type admits "auto" (whose intrinsic-size measure drives layout — a background must never do that) and "sliced", and its unknown-keyword fallback is Auto. This spec’s modes all map to layout-inert NodeImageModes.
SliceSpec
9-slice scaling parameters, mirroring bevy_sprite::TextureSlicer.
SourceRect
A source sub-rect in texture pixels: top-left (x, y) plus width/height. Converted to a bevy_math::Rect (min/max corners) in ui_map.
TiledSpec
"tiled" scaling: the whole image repeats once stretched beyond stretch_value.

Enums§

BackgroundImageMode
BackgroundImageSpec::mode keywords. Every variant maps to a layout-inert NodeImageMode (Stretch or Tiled) — never Auto.
BackgroundImageSource
Where a super::style::Style::background_image samples from: a bare string is an asset path (AssetServer-loaded, like an image element’s src); the { texture } object names an app-registered texture in crate::portal::RenderTargets (typically RenderTargets::register — bound late: an unknown name shows the transparent placeholder until the app registers it). Texture backgrounds are for static content — they don’t participate in live-repaint tracking; continuously-updating render targets belong in a <portal> element.
ImageMode
How an image fits its node. A bare string ("auto"/"stretch") maps to the trivial bevy_ui modes; the type-tagged object forms map to bevy’s 9-slice ("sliced") and "tiled" scaling. Bevy-free; converted to NodeImageMode in ui_map.
ImageModeSpec
The object forms of ImageMode, discriminated by their type field.
SliceBorder
9-slice border insets: a single number (uniform) or per-side, in source-texture pixels.
SliceScale
How a 9-slice section scales when resized: "stretch" (the keyword) or { tile }, where tile is the repeat stretch_value.