@thi.ng/rasterize
Version:
Headless 2D shape drawing, filling & rasterization for arbitrary targets/purposes (no canvas required)
18 lines • 699 B
TypeScript
import type { IGrid2D, TypedArray } from "@thi.ng/api";
import type { Shader2D } from "./api.js";
/**
* Draws a filled polygon (simple, no holes) into given grid. Each grid cell's
* value is obtained from user supplied shader function which will be called
* with the pixel's `x,y` coords.
*
* Based on Efficient Polygon Fill Algorithm by Darel Rex Finley
* http://alienryderflex.com/polygon_fill/
*
* Bounds calculation and clipping added by Karsten Schmidt
*
* @param grid -
* @param pts -
* @param val -
*/
export declare const fillPoly: <T extends any[] | TypedArray, P>(grid: IGrid2D<T, P>, pts: ArrayLike<number>[], val: P | Shader2D<P>) => void;
//# sourceMappingURL=poly.d.ts.map