imageBackground

fun Modifier.imageBackground(source: ImageSource, scale: ImageScale = ImageScale.Stretch): Modifier(source)

Paints arbitrary immutable image pixels behind the modified component's content.

The image may be loaded from the active resource manager by a version adapter, preserving resource-pack replacement while the retained modifier remains platform-neutral. This behavior does not alter measurement.

Receiver

immutable modifier chain.

Return

a new chain containing one active background-image node.

Parameters

source

immutable pixels or a resource resolved from the active runtime manager.

scale

typed nearest-sampled destination mapping.

Throws

when the source image has an empty axis.

when tiled destination coordinates overflow.


fun Modifier.imageBackground(source: ImageSource, border: Insets, centerMode: NineSliceCenterMode = NineSliceCenterMode.Tiled): Modifier(source)

Paints arbitrary immutable image pixels as a Minecraft-compatible nine-slice background behind content.

When the destination matches both source axes, paint emits one complete image. When one axis matches, paint emits the native three-segment order; otherwise it emits top-left through bottom-right in row-major order. NineSliceCenterMode.Tiled repeats each expandable source segment from its top-left and clips the final tile, while NineSliceCenterMode.Stretched maps each complete expandable segment once. Destination borders are clamped independently to half of the destination axis exactly like Minecraft 26.2. This behavior does not alter measurement.

Receiver

immutable modifier chain.

Return

a new chain containing one active nine-slice background node.

Parameters

source

immutable pixels or a resource resolved from the active runtime manager.

border

non-negative source border widths that leave a nonempty center on both axes.

centerMode

typed mapping for expandable edges and the center.

Throws

when the source image has an empty axis or the borders consume a source center.

when source validation, segment, or tiled destination arithmetic overflows.