typography-canvas-renderer
Version:
A lightweight npm package for rendering typographic content (text and images) on HTML5 Canvas with full CSS styling support including borders, border-radius, multiple border styles, inline text rendering, auto height calculation, and image support
21 lines • 1.09 kB
TypeScript
/**
* Main function to render typography content on canvas
* @param input - Input object containing canvas configuration and elements
* @param canvasContext - Optional existing canvas context to use
* @returns Promise that resolves to a Blob containing the rendered image
*/
export declare const renderCanvas: (input: unknown, canvasContext?: CanvasRenderingContext2D) => Promise<Blob>;
/**
* Renders canvas and returns data URL instead of Blob
* @param input - Input object containing canvas configuration and elements
* @param canvasContext - Optional existing canvas context to use
* @returns Promise that resolves to a data URL string
*/
export declare const renderCanvasAsDataURL: (input: unknown, canvasContext?: CanvasRenderingContext2D) => Promise<string>;
/**
* Clears the internal image cache
*/
export declare const clearCache: () => void;
export type { Input, CanvasConfig, TextElement, ImageElement, RenderElement, ParsedCSS } from './types.js';
export { InvalidInputError, CssValidationError, ImageLoadError } from './errors.js';
//# sourceMappingURL=index.d.ts.map