# `Drafter.Widget.Digits.Image`
[🔗](https://github.com/jaman/drafter/blob/main/lib/drafter/widget/digits/image.ex#L1)

Draws `Drafter.Widget.Digits` text as a transmitted terminal image.

On a terminal supporting the kitty, iTerm2, or sixel protocol, the glyph
bitmaps are scaled into a raster and sent as a picture, so strokes land on
pixel rather than cell boundaries.

Every function returns `nil` when no protocol is available, and the widget
renders cells instead.

# `protocol`

```elixir
@spec protocol(atom() | nil) :: atom() | nil
```

The pixel protocol in use, or `nil` when the terminal has none.

# `raster`

```elixir
@spec raster([String.t()], {pos_integer(), pos_integer()}, tuple()) ::
  FrenchCurve.Raster.t()
```

Rasterises text at the largest whole scale that fits a cell box.

Scale is never below one; a box too small for native size is handled by the
encoder's `fit`, which scales the finished picture down.

# `render`

```elixir
@spec render(
  String.t(),
  {pos_integer(), pos_integer()},
  tuple(),
  atom() | nil,
  term()
) ::
  {iodata(), iodata()} | nil
```

Renders text as a transmitted image sized to a cell box.

Returns `{paint, clear}` as `Drafter.Widget`'s `image/3` expects, or `nil`
when the text is empty, the box has no area, or the terminal cannot display
an image.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
