/** * High-level rasterization API */ import type { Font } from "../font/font.ts"; import { type GlyphPath } from "../render/path.ts"; import type { Matrix2D, Matrix3x3 } from "../render/outline-transform.ts"; import type { GlyphId } from "../types.ts"; import { type Bitmap, type GlyphRasterizeOptions, type RasterizedGlyph, type RasterizeOptions, type TextRasterizeOptions } from "./types.ts"; /** * Rasterize a glyph path to a bitmap * @param path Glyph path to rasterize * @param options Rasterization options including dimensions, scale, and pixel mode * @returns Rendered bitmap of the glyph */ export declare function rasterizePath(path: GlyphPath, options: RasterizeOptions): Bitmap; /** * Rasterize a glyph from a font * @param font Font containing the glyph * @param glyphId ID of the glyph to rasterize * @param fontSize Font size in pixels * @param options Optional rendering settings (pixel mode, padding, hinting) * @returns Rasterized glyph with bitmap and bearing information, or null if glyph is empty */ export declare function rasterizeGlyph(font: Font, glyphId: GlyphId, fontSize: number, options?: GlyphRasterizeOptions): RasterizedGlyph | null; export declare function rasterizeGlyphWithVariation(font: Font, glyphId: GlyphId, fontSize: number, axisCoords: number[], options?: GlyphRasterizeOptions): RasterizedGlyph | null; /** * Rasterize a glyph and apply a bitmap transform (2D or 3D) */ export declare function rasterizeGlyphWithTransform(font: Font, glyphId: GlyphId, fontSize: number, matrix: Matrix2D | Matrix3x3, options?: GlyphRasterizeOptions & { /** Translation offset in 26.6 units (applied after matrix) */ offsetX26?: number; /** Translation offset in 26.6 units (applied after matrix) */ offsetY26?: number; }): RasterizedGlyph | null; /** * Rasterize text string using shaped glyphs * @param font Font to use for rendering * @param text Text string to rasterize * @param fontSize Font size in pixels * @param options Optional rendering settings (pixel mode, padding) * @returns Bitmap containing rendered text, or null if no glyphs */ export declare function rasterizeText(font: Font, text: string, fontSize: number, options?: TextRasterizeOptions): Bitmap | null; /** * Export bitmap to raw RGBA pixels (for WebGL textures, etc.) * @param bitmap Source bitmap to convert * @returns RGBA pixel array (4 bytes per pixel) */ export declare function bitmapToRGBA(bitmap: Bitmap): Uint8Array; /** * Export bitmap to grayscale array * @param bitmap Source bitmap to convert * @returns Grayscale pixel array (1 byte per pixel) */ export declare function bitmapToGray(bitmap: Bitmap): Uint8Array; export { type BBox, evaluateCubic, evaluateQuadratic, getCubicExtrema, getExactBounds, getQuadraticExtrema, } from "./bbox.ts"; export { blendBitmap, convertBitmap, copyBitmap, emboldenBitmap, resizeBitmap, resizeBitmapBilinear, } from "./bitmap-utils.ts"; export { blurBitmap, boxBlur, createGaussianKernel, gaussianBlur, } from "./blur.ts"; export { type ColorStop, createGradientBitmap, type Gradient, interpolateGradient, type LinearGradient, type RadialGradient, rasterizePathWithGradient, } from "./gradient.ts"; export { renderSdf, type SdfOptions } from "./sdf.ts"; export { type LineCap, type LineJoin, type StrokerOptions, strokePath, } from "./stroker.ts"; export { condensePath, emboldenPath, obliquePath, transformPath, } from "./synth.ts"; export { type Bitmap, clearBitmap, createBitmap, createBottomUpBitmap, FillRule, PixelMode, type RasterizedGlyph, type RasterizeOptions, type Span, } from "./types.ts";