Draws Drafter.Widget.Slider through the french_curve rasteriser.
One drawing path with two outputs: a transmitted picture for terminals speaking the
kitty, iTerm2 or sixel protocol, and braille Drafter.Draw.Strips for any other
truecolor terminal. Both draw the same shape — a rounded track, a rounded fill up to
the value, and a disc for the thumb — so the slider keeps its outline wherever it is
drawn.
A spec/0 describes what to draw; the caller supplies the cell box and this module
picks the pixel resolution. Every function returns nil rather than raising when the
box has no area or the drawing fails, and the widget falls back to characters.
Summary
Types
What to draw: where the thumb sits, which way the slider runs, and the colours of the track, the fill behind the thumb and the thumb itself.
Functions
Renders spec as rows braille strips of cols cells, or nil when it cannot be
drawn.
Renders spec into a {paint, clear} pair for a cols by rows cell box.
How a slider with this renderer should be drawn: :pixel, :braille or :text.
The pixel protocol in use, or nil when the terminal has none.
Draws spec into a raster width by height pixels.
Types
@type rgba() :: {0..255, 0..255, 0..255, 0..255}
@type spec() :: %{ fraction: float(), orientation: :horizontal | :vertical, track: rgba(), fill: rgba(), thumb: rgba() }
What to draw: where the thumb sits, which way the slider runs, and the colours of the track, the fill behind the thumb and the thumb itself.
Functions
@spec braille_strips( spec(), {pos_integer(), pos_integer()} ) :: [Drafter.Draw.Strip.t()] | nil
Renders spec as rows braille strips of cols cells, or nil when it cannot be
drawn.
@spec image(spec(), {pos_integer(), pos_integer()}, atom() | nil, term()) :: {iodata(), iodata()} | nil
Renders spec into a {paint, clear} pair for a cols by rows cell box.
Returns nil when the terminal has no pixel protocol or the box has no area.
@spec mode(atom() | nil) :: :pixel | :braille | :text
How a slider with this renderer should be drawn: :pixel, :braille or :text.
Resolution follows Drafter.Widget.Chart.Pixel.resolve/1, so the DRAFTER_MODE
environment variable wins over a per-widget renderer, which wins over the mode the
app was run with. A mode asking for pixels on a terminal with no graphics protocol
falls back to braille.
The pixel protocol in use, or nil when the terminal has none.
@spec raster( spec(), {integer(), integer()} ) :: FrenchCurve.Raster.t() | nil
Draws spec into a raster width by height pixels.
Returns nil for a raster with no area.