API Reference open_fresco v#0.1.0

Copy Markdown View Source

Modules

OG-image / social-card scenes rendered server-side, built to run on Fresco canvases.

The browser editor stage — a Phoenix.LiveComponent that renders a scene as a server-authoritative SVG preview and lets the user select, drag, resize, reorder, and delete elements on a Fresco-style artboard.

Pure scene-mutation and hit-test operations for the editor — the server-authoritative core the editor LiveComponent and its JS hook drive. Keeping them pure (no LiveView, no DOM) makes the editing model fully testable without a browser; the interactive layer is a thin shell over these.

Resolves a scene's computed layout before it is drawn

Text measurement — the primitive that turns estimate-based layout into measurement-accurate layout (the checklist's "same wrap points, same measured sizes" gate).

Convert a phoenix_kit_og canvas map into an OpenFresco.Scene — the concrete step that lets an og host migrate stored templates and render them through open_fresco.

SVG → PNG conversion, browser-free. Adopts phoenix_kit_og's approach: an embedded resvg/tiny-skia backend when available, with graceful fallbacks.

The PNG facade: scene → SVG → raster → PNG bytes. Browser-free and deterministic.

The scene model: a fixed-size canvas plus a z-ordered list of elements.

Named canvas-size presets for common social-card targets. Render a responsive scene (one built with Scene.place/1 insets) at any of these with Scene.put_size/3 — or use your own dimensions; nothing here is required, render/3 accepts any canvas size.

Inline token substitution — the templating model shared with phoenix_kit_og, ported for byte-compatibility so stored templates migrate without rewriting bindings.

Scene → SVG generator. The shared intermediate representation: the editor preview and (later) the PNG rasterizer both consume this output, so what you edit is what renders.