EgdTextPanel (egd_text_panel v0.1.0)

Copy Markdown View Source

Simple text panel for use with EGD

This text panel implements the Erlang I/O server protocol so write text to it with IO.puts and the like.

Example:

{:ok, io} = EgdTextPanel.start_link(your_options)
IO.puts(io, "Hello")

Summary

Types

Text panel margins within the image dimensions

Options for start_link/1

Functions

Returns a specification to start this module under a supervisor.

Starts an EGD text panel

Types

margins()

Text panel margins within the image dimensions

Fields are left, top, right, bottom margins in pixels

options()

@type options() :: [
  renderer: module(),
  renderer_state: term(),
  margins: margins(),
  font_path: Path.t(),
  width: pos_integer(),
  height: pos_integer(),
  font_color: atom() | {byte(), byte(), byte()},
  name: GenServer.name()
]

Options for start_link/1

  • :font_color - a supported EGD font color atom or a 3-tuple with RGB values. Defaults to :black
  • :font_path - path to the font to use. Defaults to EGD's built-in font
  • :height - image height. Defaults to 200.
  • :margins - margins as a 4-tuple. Defaults to {0, 0, 0, 0}
  • :name - a name for the GenServer
  • :renderer - the module that implements the EgdTextPanel.Renderer. Required.
  • :renderer_state - the initial state for the behaviour. Defaults to %{}
  • :width - image width. Defaults to 320.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts \\ [])

@spec start_link(options()) :: GenServer.on_start()

Starts an EGD text panel

See options/0 for options. :renderer is the only required option.