toBrush

Converts a BackgroundSchema into the Compose Brush that renders it.

The brush is remembered against the schema, the resolved colors and the current density, so it is only rebuilt when one of those actually changes. Sizing is intentionally left to the brush itself — ShaderBrush.createShader(size) resolves Offset.Infinite, Offset.Unspecified and Float.POSITIVE_INFINITY at draw time, which is why the schema never needs the tile size.