UNPKG

@thi.ng/pixel

Version:

Typedarray integer & float pixel buffers w/ customizable formats, blitting, drawing, convolution

14 lines (13 loc) 377 B
import { Lane } from "../api.js"; import { __luminanceABGR } from "../internal/utils.js"; import { defIntFormat } from "./int-format.js"; const GRAY16 = defIntFormat({ type: "u16", size: 16, channels: [{ size: 16, lane: Lane.RED }], fromABGR: (x) => (__luminanceABGR(x) + 0.5 | 0) * 257, toABGR: (x) => (4278190080 | (x >>> 8) * 65793) >>> 0 }); export { GRAY16 };