# `Linocut.Pic`
[🔗](https://github.com/jaman/cauldron/blob/v0.1.3/linocut/lib/linocut/pic.ex#L1)

A picture kept in a file: a palette, a blank line, and the picture.

    R #c33
    W white

    ..RR..
    .RWWR.

Each palette line is one character, a space, and a colour as `Linocut.Palette` reads
it: `#rgb`, `#rrggbb`, `#rrggbbaa` or a colour name. `.` and space in the picture are
transparent. `parse/2` takes `Linocut.sprite/3`'s options.

# `text`

```elixir
@type text() :: %{palette: [{String.t(), String.t()}], frames: [[String.t()]]}
```

# `frames`

```elixir
@spec frames(String.t(), keyword()) ::
  {:ok, [FrenchCurve.Raster.t()]} | {:error, term()}
```

The frames the text describes, one raster each, or why it could not be read.

# `parse`

```elixir
@spec parse(String.t(), keyword()) :: {:ok, FrenchCurve.Raster.t()} | {:error, term()}
```

The raster the text describes, or why it could not be read.

Frames separated by a `---` line come back as one raster with the frames side by
side, left to right, as a strip; `frames/2` gives them one by one.

# `read`

```elixir
@spec read(String.t()) :: {:ok, text()} | {:error, term()}
```

The text as data, nothing rendered: the palette as `{key, colour_spec}` pairs in the
order written, and the frames as their rows of keys. `write/1` turns it back.

## Examples

    iex> Linocut.Pic.read("R #c33\n\n.R\nR.\n---\nR.\n.R\n")
    {:ok, %{palette: [{"R", "#c33"}], frames: [[".R", "R."], ["R.", ".R"]]}}

# `separator`

```elixir
@spec separator() :: String.t()
```

The line that separates frames in a pic.

# `write`

```elixir
@spec write(text()) :: String.t()
```

The text of a picture given as `read/1` gives it.

---

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