dmnsgn / bayer

Compute the bayer matrix based for powers of two. Useful for ordered dithering algorithms.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bayer

npm version stability-stable npm minzipped size dependencies types Conventional Commits styled with prettier linted with eslint license

Compute the bayer matrix for powers of two. Useful for ordered dithering algorithms.

paypal coinbase twitter

Installation

npm install bayer

Usage

import bayer from "bayer";

const matrix = bayer();
// => [
//   [0, 2],
//   [3, 1],
// ];

API

bayer(size) ⇒ Array.<Array>

Compute the bayer matrix for powers of two.

Kind: global function Returns: Array.<Array> - A 2D array containing the matrix.

Param Type Default Description
size number 2 Needs to be a power of two otherwise will throw a "Maximum call stack size exceeded" Error.

License

MIT. See license file.

About

Compute the bayer matrix based for powers of two. Useful for ordered dithering algorithms.

License:MIT License


Languages

Language:HTML 69.1%Language:JavaScript 30.9%