# `CauldronGPU.Sectors.Live.Pictures`
[🔗](https://github.com/jaman/cauldron/blob/v0.3.3/cauldron_gpu/lib/cauldron_gpu/sectors/live/pictures.ex#L2)

Pictures of a `Cauldron2D.Sectors.Pictures` set uploaded on first use, each through a
light table: table `nil` shows the palette's own colours, table `n` each colour index
first mapped through the set's table `n` (as a fixed light table draws it). Textures
and materials are kept by `{picture, table}` and made once.

    pictures = CauldronGPU.Sectors.Live.Pictures.new(set, palette)
    {%{handle: handle, masked: false}, pictures} = CauldronGPU.Sectors.Live.Pictures.texture(pictures, target, 7, nil)
    {material, pictures} = CauldronGPU.Sectors.Live.Pictures.material(pictures, target, {:wall, 7, nil}, fn texture -> %CauldronGPU.Material{base_texture: texture.handle} end)

The set must keep its pictures in Elixir (`Pictures.new(named, tables, native: false)`);
`palette` is 768 bytes.

# `t`

```elixir
@type t() :: %CauldronGPU.Sectors.Live.Pictures{
  colours: %{required(non_neg_integer() | nil) =&gt; tuple()},
  materials: %{required(term()) =&gt; CauldronGPU.Handle.t()},
  palette: binary(),
  set: Cauldron2D.Sectors.Pictures.t(),
  textures: %{
    required({non_neg_integer(), non_neg_integer() | nil}) =&gt; texture()
  }
}
```

# `texture`

```elixir
@type texture() :: %{handle: CauldronGPU.Handle.t(), masked: boolean()}
```

# `colours`

```elixir
@spec colours(t(), non_neg_integer() | nil) :: {tuple(), t()}
```

The palette's colours through light table `table` (`nil` for none), as a tuple of 256 RGBA binaries.

# `handles`

```elixir
@spec handles(t()) :: [CauldronGPU.Handle.t()]
```

Every handle uploaded.

# `material`

```elixir
@spec material(t(), CauldronGPU.Target.t(), tuple(), (texture() -&gt;
                                                  CauldronGPU.Material.t())) ::
  {CauldronGPU.Handle.t(), t()}
```

The material kept as `key`, made the first time from `make`, given the texture of
`key`'s picture through its table: `key` is a tuple whose second and third elements
are the picture and the table.

# `new`

```elixir
@spec new(Cauldron2D.Sectors.Pictures.t(), binary()) :: t()
```

No pictures uploaded yet from `set`, coloured by `palette`.

# `texture`

```elixir
@spec texture(t(), CauldronGPU.Target.t(), non_neg_integer(), non_neg_integer() | nil) ::
  {texture(), t()}
```

The texture of `picture` through light table `table`, uploaded through `target` the first time.

---

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