@thi.ng/pixel
Version:
Typedarray integer & float pixel buffers w/ customizable formats, blitting, drawing, convolution
17 lines (16 loc) • 471 B
JavaScript
import { Lane } from "../api.js";
import { __luminanceABGR } from "../internal/utils.js";
import { defIntFormat } from "./int-format.js";
const GRAY_ALPHA16 = defIntFormat({
type: "u32",
size: 32,
channels: [
{ size: 8, lane: Lane.ALPHA },
{ size: 16, lane: Lane.RED }
],
fromABGR: (x) => (__luminanceABGR(x) + 0.5 | 0) * 257 | (x >>> 8 & 16711680) * 257,
toABGR: (x) => (x & 4278190080 | (x >>> 8 & 255) * 65793) >>> 0
});
export {
GRAY_ALPHA16
};