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

How a tile maps onto the terminal's pixels once the session knows the size of a cell.

A tile is drawn at a whole multiple of its own pixels, or shrunk by a divisor of its
size, whichever comes nearest to `zoom` rows of cells — so every image is sent at the
size it is shown and the terminal scales nothing.

    scale = Cauldron2D.Drafter.Surface.Scale.new({14, 30}, 16, 1)
    scale.pixels
    #=> 32

# `factor`

```elixir
@type factor() :: {:magnify, pos_integer()} | {:reduce, pos_integer()}
```

# `t`

```elixir
@type t() :: %Cauldron2D.Drafter.Surface.Scale{
  cell: {pos_integer(), pos_integer()},
  factor: factor(),
  pixels: pos_integer(),
  tile: pos_integer()
}
```

# `new`

```elixir
@spec new({pos_integer(), pos_integer()}, pos_integer(), number()) :: t()
```

The scale for a terminal whose cells are `cell` pixels, an atlas whose tiles are `tile`
pixels square, at `zoom` (`1` a tile the height of a row).

# `pane`

```elixir
@spec pane(t(), map()) :: {pos_integer(), pos_integer()}
```

The pane `rect` (in cells) in pixels.

# `place`

```elixir
@spec place(t(), {number(), number()}) :: {integer(), integer(), integer(), integer()}
```

Where a point `tiles` from the pane's top left falls: `{column, row, x_offset, y_offset}`,
the cell and the pixels into it.

# `scroll`

```elixir
@spec scroll(t(), {number(), number()}) :: {integer(), integer()}
```

A fraction of a tile as whole drawn pixels.

# `tiles`

```elixir
@spec tiles(t(), map()) :: {float(), float()}
```

How many tiles across and down the pane `rect` shows, fractional at the edges.

---

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