# `Cauldron2D.Drafter.Sprites`
[🔗](https://github.com/jaman/cauldron/blob/v0.1.2/cauldron_2d_drafter/lib/cauldron_2d/drafter/sprites.ex#L1)

An atlas's art as stored kitty images, transmitted once and placed many times.

    Drafter.Compositor.write_raw(Cauldron2D.Drafter.Sprites.transmit(:my_game))

Every frame of every art in the atlas gets a stable image id from `image_id/3`, so a
surface can place it by id on any later frame without sending pixels again. Transmit
once per session, and again after anything that empties the terminal's image store or
changes the atlas.

# `image_id`

```elixir
@spec image_id(Cauldron2D.Atlas.name() | Cauldron2D.Atlas.t(), Cauldron2D.Atlas.art()) ::
  pos_integer()
```

The kitty image id under which the first frame of `art` of `atlas` is stored; the same on every call.

# `image_id`

```elixir
@spec image_id(
  Cauldron2D.Atlas.name() | Cauldron2D.Atlas.t(),
  Cauldron2D.Atlas.art(),
  integer()
) ::
  pos_integer()
```

The kitty image id of the frame of `art` showing at `at_ms`.

# `label_id`

```elixir
@spec label_id(
  Cauldron2D.Atlas.name() | Cauldron2D.Atlas.t(),
  String.t(),
  Cauldron2D.Atlas.rgb(),
  pos_integer()
) :: pos_integer()
```

The kitty image id of `text` drawn in `colour` at `scale` by `Linocut.Font`, the same on every call.

# `label_transmit`

```elixir
@spec label_transmit(
  Cauldron2D.Atlas.name() | Cauldron2D.Atlas.t(),
  String.t(),
  Cauldron2D.Atlas.rgb(),
  pos_integer(),
  keyword()
) :: iodata()
```

The bytes that store `text` drawn in `colour` at `scale` under its `label_id/4`.

# `transmit`

```elixir
@spec transmit(Cauldron2D.Atlas.name() | Cauldron2D.Atlas.t(), keyword()) :: iodata()
```

The bytes that store every frame of every art of `atlas` in the terminal, without
displaying any.

## Options

  * `:scale` — a whole number of times each sprite's pixels are repeated, so a placement
    is drawn at that size without the terminal scaling it. Default `1`
  * `:compress` — zlib each transmit. Default `true`

---

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