OgEx.Renderer behaviour (og_ex v0.1.0)

Copy Markdown View Source

Behaviour implemented by HTML-to-image rendering backends.

Summary

Callbacks

Converts a complete HTML document into an encoded image binary.

Types

option()

@type option() ::
  {:width, pos_integer()}
  | {:height, pos_integer()}
  | {:format, :png | :jpeg | :webp}
  | {:fonts, [binary()]}

Callbacks

render(html, list)

@callback render(html :: binary(), [option()]) :: {:ok, binary()} | {:error, term()}

Converts a complete HTML document into an encoded image binary.

Implementations must return bytes in the requested output format rather than raw RGBA pixels.