Figler.Render (figler v0.1.0-beta.1)

Copy Markdown View Source

Prepares effective .fig scenes and renders them through optional backends.

Rendering uses Figler.Scene.Graph for resolved hierarchy and instance semantics, then joins effective nodes with a root-focused native projection of paint and shape metadata.

Summary

Functions

Decodes an input and prepares a rendering-neutral effective scene.

Renders a .fig input with the Skia backend.

Functions

prepare(input, opts \\ [])

@spec prepare(
  binary() | Figler.Document.t(),
  keyword()
) :: {:ok, Figler.Render.Scene.t()} | {:error, term()}
@spec prepare(
  Figler.Document.t(),
  keyword()
) :: {:ok, Figler.Render.Scene.t()} | {:error, term()}

Decodes an input and prepares a rendering-neutral effective scene.

An already-opened Figler.Document can be reused to avoid decoding the archive and message again.

render(input, opts \\ [])

@spec render(
  binary() | Figler.Document.t() | Figler.Render.Scene.t(),
  keyword()
) :: {:ok, binary() | map(), map()} | {:error, term()}

Renders a .fig input with the Skia backend.

Rendering uses effective normalized metadata for hierarchy, instance overrides, paints, geometry, effects, masks, text, fonts, and compositing. Unsupported or approximate features—including unavailable fonts, missing glyph coverage, and substitutions—are returned as warnings, or as an error with strict: true. Deterministic caller-provided fallback fonts can be passed with :fallback_font_paths or :fallback_typefaces.

Public options are documented by Figler.Render.Options. Unknown or malformed options return {:error, {:invalid_render_options, errors}}. Non-finite or oversized output bounds return {:error, {:invalid_render_bounds, context}} before a canvas is allocated. Rendering without the optional Skia dependency returns {:error, :skia_not_available}.