/** * Fluent API for transform and rendering operations * * Provides two styles of composition: * 1. Builder pattern: glyph(font, id).scale(2).blur(5).toRGBA() * 2. Pipe pattern: pipe(path, scale(2), rasterize(...), blur(5), toRGBA) */ import type { Font } from "../font/font.ts"; import { atlasToAlpha, atlasToRGBA, buildAsciiAtlas, buildAtlas, buildStringAtlas, getGlyphUV } from "../raster/atlas.ts"; import { buildMsdfAsciiAtlas, buildMsdfAtlas, buildMsdfStringAtlas, msdfAtlasToRGB, msdfAtlasToRGBA } from "../raster/msdf.ts"; import { rasterizeGlyph, rasterizeGlyphWithTransform, rasterizeText } from "../raster/rasterize.ts"; import type { AtlasOptions, Bitmap, GlyphAtlas, MsdfAtlasOptions } from "../raster/types.ts"; import type { GlyphPath } from "../render/path.ts"; import { renderShapedText, renderShapedTextWithVariation, shapedTextToSVG, shapedTextToSVGWithVariation } from "../render/path.ts"; import type { GlyphId } from "../types.ts"; import { BitmapBuilder } from "./bitmap-builder.ts"; import { PathBuilder } from "./path-builder.ts"; export { BitmapBuilder } from "./bitmap-builder.ts"; export { PathBuilder } from "./path-builder.ts"; export type { AutoRasterOptions, CanvasOptions, RasterOptions, SVGElementOptions, SVGOptions, TransformState, } from "./types.ts"; /** * Create PathBuilder from a font glyph * * @example * ```typescript * const rgba = glyph(font, glyphId) * ?.scale(2) * .rotateDeg(15) * .rasterizeAuto({ padding: 2 }) * .blur(5) * .toRGBA(); * ``` */ export declare function glyph(font: Font, glyphId: GlyphId): PathBuilder | null; /** * Create PathBuilder from a character in a font * * @example * ```typescript * const rgba = char(font, "A") * ?.scale(2) * .rasterizeAuto() * .toRGBA(); * ``` */ export declare function char(font: Font, character: string): PathBuilder | null; /** * Create PathBuilder from a font glyph with variable font coordinates * * @example * ```typescript * const rgba = glyphVar(font, glyphId, [400, 100]) // weight=400, width=100 * ?.scale(2) * .rasterizeAuto() * .toRGBA(); * ``` */ export declare function glyphVar(font: Font, glyphId: GlyphId, axisCoords: number[]): PathBuilder | null; /** * Wrap an existing GlyphPath in a PathBuilder * * @example * ```typescript * const existingPath = getGlyphPath(font, glyphId); * const rgba = path(existingPath) * .scale(2) * .rasterizeAuto() * .toRGBA(); * ``` */ export declare function path(p: GlyphPath): PathBuilder; /** * Wrap an existing Bitmap in a BitmapBuilder * * @example * ```typescript * const existingBitmap = rasterizePath(path, options); * const rgba = bitmap(existingBitmap) * .blur(5) * .toRGBA(); * ``` */ export declare function bitmap(b: Bitmap): BitmapBuilder; /** * Combine multiple PathBuilders into one * * @example * ```typescript * const h = glyph(font, hGlyphId)?.translate(0, 0); * const i = glyph(font, iGlyphId)?.translate(100, 0); * if (h && i) { * const combined = combine(h, i).scale(2).rasterizeAuto().toRGBA(); * } * ``` */ export declare function combine(...paths: PathBuilder[]): PathBuilder; export { adaptiveBlur, blur, boxBlur, cascadeBlur, clone, combinePaths, condensePath, convert, copy, embolden, emboldenGlyph, emboldenPath, fastBlur, fromGlyph, italic, matrix, obliquePath, pad, perspective, pipe, rasterize, rasterizeAuto, rasterizeWithGradient, renderMsdf, renderSdf, resize, resizeBilinear, rotate, rotateDeg, scale, shear, shearBitmapX, shearBitmapY, shearGlyphX, shearGlyphY, shift, strokeAsymmetric, strokeAsymmetricCombined, strokePath, toGray, toRGBA, toSVG, transformBitmap2D, transformBitmap3D, transformGlyph2D, transformGlyph3D, translate, } from "./pipe.ts"; export { buildAtlas, buildAsciiAtlas, buildStringAtlas, atlasToRGBA, atlasToAlpha, getGlyphUV, }; export { buildMsdfAtlas, buildMsdfAsciiAtlas, buildMsdfStringAtlas, msdfAtlasToRGB, msdfAtlasToRGBA, }; export { rasterizeGlyph, rasterizeGlyphWithTransform, rasterizeText }; export { renderShapedText, shapedTextToSVG, renderShapedTextWithVariation, shapedTextToSVGWithVariation, }; export type { AtlasOptions, GlyphAtlas, MsdfAtlasOptions };