# `Cauldron3D.Frame`
[🔗](https://github.com/jaman/cauldron/blob/v0.2.2/cauldron_3d/lib/cauldron_3d/frame.ex#L1)

A rendered picture, rows top to bottom: indexed colour, one byte per pixel, or RGBA,
four.

    frame = Cauldron3D.Render.draw(view, polygons)
    Cauldron3D.Frame.rgba(frame, palette)

# `t`

```elixir
@type t() :: %Cauldron3D.Frame{
  format: :indexed | :rgba,
  height: pos_integer(),
  pixels: binary(),
  width: pos_integer()
}
```

# `blit`

```elixir
@spec blit(t(), t() | Cauldron3D.Texture.t(), {integer(), integer()}, byte() | nil) ::
  t()
```

`overlay` drawn over `frame` with its top left at `{x, y}`, its pixels of colour
`clear` left out; the parts outside the frame are cut off. A `Cauldron3D.Texture`
serves as an overlay too. On an RGBA frame the overlay is RGBA too, laid over by its
alpha, and `clear` is not used.

# `new`

```elixir
@spec new(pos_integer(), pos_integer(), byte()) :: t()
```

A frame of one colour.

# `rgb`

```elixir
@spec rgb(t(), binary() | nil) :: binary()
```

The frame as RGB bytes: an indexed frame through `palette`.

# `rgba`

```elixir
@spec rgba(t(), binary() | nil) :: binary()
```

The frame as RGBA bytes: an indexed frame through `palette`, 768 bytes of red, green and blue.

# `scale`

```elixir
@spec scale(t() | Cauldron3D.Texture.t(), pos_integer(), pos_integer()) :: t()
```

The frame scaled to `{width, height}` by taking the nearest pixel.

---

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