/** * @typedef {import('./configuration.js').tConfiguration} tConfiguration * @typedef {import('./image_type.js').ImageType} ImageType * @typedef {import('./stage_type.js').StageType} StageType * @typedef {import('wmap-parser').Map} ParsedMap * @typedef {import('canvas').Canvas} Canvas */ /** * Render a parsed Wardley map to a canvas element * Works in both browser and Node.js environments * * @param {ParsedMap} map - Parsed map object from wmap-parser * @param {HTMLCanvasElement|Canvas} canvas - Canvas element (browser) or Canvas instance (Node.js) * @param {StageType} [stageType=StageType.ACTIVITIES] - The labels to use for each stage in the map. * @param {tConfiguration} overrides - User configuration overrides * @returns {Promise} * * @example * // Browser * import { parse } from 'wmap-parser'; * import { renderToCanvas } from 'wmap-renderer-canvas'; * * const map = parse(wmapSource); * const canvas = document.getElementById('myCanvas'); * await renderToCanvas(map, canvas); * * @example * // Node.js * import { createCanvas } from 'canvas'; * import { parse } from 'wmap-parser'; * import { renderToCanvas } from 'wmap-renderer-canvas'; * * const map = parse(wmapSource); * const canvas = createCanvas(1384, 1084); * await renderToCanvas(map, canvas); */ export function renderToCanvas(map: ParsedMap, canvas: HTMLCanvasElement | Canvas, stageType?: StageType, overrides?: tConfiguration): Promise; /** * Render a parsed Wardley map to an image stream * Only available in Node.js environments * * @param {ParsedMap} map - Parsed map object from wmap-parser * @param {ImageType} imageType - Output image format ('png', 'jpeg', or 'pdf') * @param {StageType} [stageType=StageType.ACTIVITIES] - The labels to use for each stage in the map. * @param {tConfiguration} overrides - User configuration overrides * @returns {Promise} Stream of the rendered image * * @throws {Error} If not in Node.js environment * @throws {Error} If canvas module is not available * @throws {Error} If imageType is not supported * * @example * import { parse } from 'wmap-parser'; * import { renderToImage } from 'wmap-renderer-canvas'; * import fs from 'fs'; * * const map = parse(wmapSource); * const stream = await renderToImage(map, 'png'); * const out = fs.createWriteStream('map.png'); * stream.pipe(out); */ export function renderToImage(map: ParsedMap, imageType?: ImageType, stageType?: StageType, overrides?: tConfiguration): Promise; export type ImageType = import("./image_type.js").ImageType; export { ImageType } from "./image_type.js"; export type StageType = import("./stage_type.js").StageType; export { StageType } from "./stage_type.js"; export type tConfiguration = import("./configuration.js").tConfiguration; export type ParsedMap = import("wmap-parser").Map; export type Canvas = import("canvas").Canvas; import { StageType } from "./stage_type.js"; import { ImageType } from "./image_type.js";