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 as rows strips of cols cells in the glyph set set, or nil when
it cannot be drawn.
How a slider with this renderer should be drawn: :pixel, :braille or :text.
Renders spec as a Drafter.Render.Picture filling a cols by rows cell box at
the widget's top left, a whole number of pixels per cell.
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 cells_strips( spec(), {pos_integer(), pos_integer()}, FrenchCurve.Backend.Cells.set() ) :: [Drafter.Draw.Strip.t()] | nil
Renders spec as rows strips of cols cells in the glyph set set, or nil when
it cannot be drawn.
@spec mode(atom() | nil) :: Drafter.Widget.Chart.Pixel.drawing()
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.
@spec picture(spec(), {pos_integer(), pos_integer()}, atom() | nil) :: Drafter.Render.Picture.t() | nil
Renders spec as a Drafter.Render.Picture filling a cols by rows cell box at
the widget's top left, a whole number of pixels per cell.
Returns nil when the terminal has no pixel protocol or the box has no area.
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.