UNPKG

libpgs

Version:

Renderer for graphical subtitles (PGS) in the browser.

29 lines (28 loc) 1.13 kB
import { SubtitleData } from "./subtitleData"; /** * This handles the low-level PGS loading and rendering. This renderer can operate inside the web worker without being * linked to a video element. */ export declare class Renderer { private readonly canvas; private readonly context; private readonly dirtyArea; constructor(canvas: OffscreenCanvas | HTMLCanvasElement); /** * Renders the given subtitle data to the canvas. * @param subtitleData The pre-compiled subtitle data to render. */ draw(subtitleData?: SubtitleData): void; /** * Draws the whole subtitle frame to the given context. * @param subtitleData The subtitle data to draw. * @param dirtyArea If given, it will extend the dirty rect to include the affected subtitle area. */ private drawSubtitleData; /** * Draws this subtitle composition to the given context. * @param compositionData The subtitle composition data to draw. * @param dirtyArea If given, it will extend the dirty rect to include the affected subtitle area. */ private drawSubtitleCompositionData; }