Isotope.Utils (Isotope v0.1.3-rc) View Source

Utilitary functions for working with noise maps.

Link to this section Summary

Functions

Shows the given noise map on the stdout using ANSI color codes.

Writes the given noise map to a PNG file.

Link to this section Functions

Specs

show_noisemap(Isotope.Noise.noisemap()) :: :ok

Shows the given noise map on the stdout using ANSI color codes.

This won't work if your terminal doesn't support ANSI color codes.

{:ok, noise} = Isotope.Noise.new()
noise |> Isotope.Noise.noise_map({50, 50})
      |> Isotope.Utils.show_noisemap()
# Outputs noise visualization
:ok
Link to this function

write_to_file(noisemap, filename)

View Source

Specs

write_to_file(Isotope.Noise.noisemap(), String.t()) :: {:ok, String.t()}

Writes the given noise map to a PNG file.

iex> {:ok, noise} = Isotope.Noise.new()
iex> {:ok, "/tmp/my_test_noise.png"} =
...>   noise
...>     |> Isotope.Noise.noise_map({200, 200})
...>     |> Isotope.Utils.write_to_file("/tmp/my_test_noise.png")