# canvas-splitter

> Split a big canvas element into a grid of lots of little canvas elements

Latest version **0.0.2** (published 2013-02-04) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install canvas-splitter
pnpm add canvas-splitter
yarn add canvas-splitter
bun add canvas-splitter
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2013-02-04 |
| First published | 2013-02-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Hugh Kennedy |
| Maintainers | hughsk |
| Keywords | canvas, split, grid, square, table, browserify |

## Links

- npm: https://www.npmjs.com/package/canvas-splitter
- Repository: https://github.com/hughsk/canvas-splitter
- npm.io page: https://npm.io/package/canvas-splitter

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2013-02-04
- 0.0.1 — 2013-02-03

## README

# canvas-splitter #

Split a big canvas element into a grid of lots of little canvas elements.
Useful for spritemaps and the like.

## Installation ##

``` bash
$ npm install canvas-splitter
```

## Usage ##

**`splitter(canvas, options)`**

Break up the canvas element, returning an array of the resulting canvas
elements. Options include:

* `width`: The width of each cell.
* `height`: The height of each cell.
* `rows`: The vertical number of cells to include. *Optional.*
* `cols`: The horizontal number of cells to include. *Optional.*

**`splitter.segment(canvas, x, y, width, height)`**

Returns a smaller copy of the canvas.

``` javascript
var splitter = require('splitter')
  , lut = require('lut')

// Create a 1024x32 colour table canvas element.
var big = lut(32, 32, 32)

// Turn that table into 32 little
// colour tables, which are 32x32 each.
var little = splitter(big, {
  width: 32, height: 32, rows: 1, cols: 32
})
```

---
_Source: https://npm.io/package/canvas-splitter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
