canvas-splitter
Split a big canvas element into a grid of lots of little canvas elements. Useful for spritemaps and the like.
Installation
$ 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.
var splitter =lut =// Create a 1024x32 colour table canvas element.var big =// Turn that table into 32 little// colour tables, which are 32x32 each.var little =