/** * Decompose path commands into rasterizer calls */ import { type Contour } from "../font/tables/glyf.ts"; import { type GlyphPath } from "../render/path.ts"; import type { GrayRaster } from "./gray-raster.ts"; import { FillRule } from "./types.ts"; /** * Outline validation error types (like FreeType's error codes) */ export declare enum OutlineError { Ok = 0, InvalidOutline = 1, InvalidArgument = 2, EmptyOutline = 3 } /** * Validation result with error code and message */ export interface ValidationResult { error: OutlineError; message?: string; } /** * Validate a GlyphPath before rasterization (like FreeType's outline validation) * Checks: path existence, command structure validity, and proper contour closure * @param path Glyph path to validate * @param allowEmpty Whether empty paths are considered valid (default: true) * @returns Validation result with error code and optional message */ export declare function validateOutline(path: GlyphPath | null | undefined, allowEmpty?: boolean): ValidationResult; /** * Convert a GlyphPath to rasterizer commands * @param raster The rasterizer instance to receive commands * @param path Path commands to decompose * @param scale Scale factor (font units to pixels) * @param offsetX X offset in pixels (default: 0) * @param offsetY Y offset in pixels (default: 0) * @param flipY Flip Y axis - font coords are Y-up, bitmap is Y-down (default: true) */ export declare function decomposePath(raster: GrayRaster, path: GlyphPath, scale: number, offsetX?: number, offsetY?: number, flipY?: boolean): void; export declare function decomposeContours(raster: GrayRaster, contours: Contour[], scale: number, offsetX?: number, offsetY?: number, flipY?: boolean): void; export declare function getContourBounds(contours: Contour[], scale: number, flipY?: boolean, roundToGrid?: boolean): { minX: number; minY: number; maxX: number; maxY: number; } | null; export declare function getPathBounds(path: GlyphPath, scale: number, flipY?: boolean, roundToGrid?: boolean): { minX: number; minY: number; maxX: number; maxY: number; } | null; /** * Get fill rule from outline flags (like FreeType's FT_OUTLINE_EVEN_ODD_FILL check) * @param path Path with optional flags * @param defaultRule Default fill rule if flags not set (default: NonZero) * @returns Fill rule to use for rendering */ export declare function getFillRuleFromFlags(path: GlyphPath | null | undefined, defaultRule?: FillRule): FillRule;