/** * Gradient fill rendering for paths */ import type { GlyphPath } from "../render/path.ts"; import { type Bitmap, type RasterizeOptions } from "./types.ts"; /** * Color stop in a gradient (RGBA, 0-255 each) */ export interface ColorStop { /** Position along gradient, 0.0 to 1.0 */ offset: number; /** RGBA color values, 0-255 each */ color: [number, number, number, number]; } /** * Linear gradient from point (x0,y0) to (x1,y1) */ export interface LinearGradient { type: "linear"; /** Start X coordinate */ x0: number; /** Start Y coordinate */ y0: number; /** End X coordinate */ x1: number; /** End Y coordinate */ y1: number; /** Color stops */ stops: ColorStop[]; } /** * Radial gradient from center point with radius */ export interface RadialGradient { type: "radial"; /** Center X coordinate */ cx: number; /** Center Y coordinate */ cy: number; /** Gradient radius */ radius: number; /** Color stops */ stops: ColorStop[]; } /** * Gradient type union */ export type Gradient = LinearGradient | RadialGradient; /** * Get color at position in gradient * * @param gradient Linear or radial gradient definition * @param x X coordinate * @param y Y coordinate * @returns RGBA color at position (0-255 each) */ export declare function interpolateGradient(gradient: Gradient, x: number, y: number): [number, number, number, number]; /** * Create a bitmap filled with gradient (no path) * * @param width Width in pixels * @param height Height in pixels * @param gradient Linear or radial gradient definition * @returns RGBA bitmap filled with gradient */ export declare function createGradientBitmap(width: number, height: number, gradient: Gradient): Bitmap; /** * Rasterize path with gradient fill * First rasterizes path to get coverage mask, then fills with gradient * * @param path Glyph path to rasterize * @param gradient Linear or radial gradient definition * @param options Rasterization options (width, height, scale, etc.) * @returns RGBA bitmap with gradient-filled path */ export declare function rasterizePathWithGradient(path: GlyphPath, gradient: Gradient, options: RasterizeOptions): Bitmap;