vivid v0.4.1 Vivid.Buffer

Used to convert a Frame into a buffer for display.

You’re unlikely to need to use this module directly, instead you will likely want to use Frame.buffer/2 instead.

Buffer implements the Enumerable protocol.

Summary

Functions

Render the buffer horizontally, ie across rows then up columns

Render the buffer vertically, ie up columns then across rows

Types

t()
t

Functions

horizontal(frame)
horizontal(Vivid.Frame.t) :: [Vivid.RGBA.t]

Render the buffer horizontally, ie across rows then up columns.

Example

iex> use Vivid
...> Frame.init(5, 5, RGBA.white)
...> |> Frame.push(Line.init(Point.init(0, 2), Point.init(5, 2)), RGBA.black)
...> |> Buffer.horizontal
...> |> to_string
"@@@@@\n" <>
"@@@@@\n" <>
"     \n" <>
"@@@@@\n" <>
"@@@@@\n"
vertical(frame)
vertical(Vivid.Frame.t) :: [Vivid.RGBA.t]

Render the buffer vertically, ie up columns then across rows.

Example

iex> use Vivid
...> Frame.init(5, 5, RGBA.white)
...> |> Frame.push(Line.init(Point.init(0, 2), Point.init(5, 2)), RGBA.black)
...> |> Buffer.vertical
...> |> to_string
"@@ @@\n" <>
"@@ @@\n" <>
"@@ @@\n" <>
"@@ @@\n" <>
"@@ @@\n"