Screen helpers · interface

OverlayText

Baking a mark into a still image sized to a video frame.

Explained in Recording and clips.

interface OverlayText
import type { OverlayText } from '@driftengine/core';

In depth

Everything is placed and sized in fractions of the frame, never pixels. That is the whole point of the module: the same overlay has to read correctly at 1080x1920 and at 720x1280, and a mark laid out in pixels is either illegible at the smaller size or covers a quarter of the smaller frame. Text scales against the frame's shorter side so a portrait and a landscape export get a mark of the same apparent size rather than one that grows with whichever dimension happens to be long.

Baked once, drawn once per captured frame. Painting a few hundred glyph cells per frame would be thirty times the work for an image that never changes.

Nothing here knows what the mark says. Text, colour and position are the caller's; the font is the engine's 5x7 grid, so a mark needs no asset and cannot fail to load.

Properties

NameTypeDescription
textreadonlystring
xreadonlynumberLeft edge, as a fraction of frame width.
yreadonlynumberTop edge, as a fraction of frame height.
cellreadonlynumberOne glyph cell, as a fraction of the frame's shorter side.
colorreadonlystring
alphareadonlyoptionalnumber