UNPKG

@thi.ng/rasterize

Version:

Headless 2D shape drawing, filling & rasterization for arbitrary targets/purposes (no canvas required)

8 lines (7 loc) 258 B
import { isFunction } from "@thi.ng/checks/is-function"; const isInBounds2D = ({ size }, x, y) => x >= 0 && x < size[0] && y >= 0 && y < size[1]; const ensureShader2D = (val) => isFunction(val) ? val : () => val; export { ensureShader2D, isInBounds2D };