Raxol.Recording.Video.Rasterizer behaviour (Raxol v2.6.0)

View Source

Behaviour for turning a standalone HTML document into a single PNG frame.

The video render target computes each frame server-side (a Raxol.Core.Buffer rendered to themed HTML via Raxol.LiveView.TerminalBridge) and then asks a rasterizer to produce the pixels. Backends are swappable: a headless-Chrome backend for full theme/effect fidelity, or a pure cell-grid backend for browser-free CI rendering.

Summary

Callbacks

Whether this backend can run in the current environment.

Render an HTML document to PNG bytes at the given viewport size.

Types

png()

@type png() :: binary()

size_px()

@type size_px() :: {pos_integer(), pos_integer()}

Callbacks

available?()

@callback available?() :: boolean()

Whether this backend can run in the current environment.

rasterize(html, size_px, opts)

@callback rasterize(html :: String.t(), size_px(), opts :: keyword()) ::
  {:ok, png()} | {:error, term()}

Render an HTML document to PNG bytes at the given viewport size.