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