Interface to composite RGB/RGBA buffers together into larger buffers representing images.
var PixelStack = require('pixel-stack');
var stack = new PixelStack;
stack.fill([0,0,0]);
stack.push([255,255,255,255,255,255], 0, 0, 2, 1);
stack.push([255,255,255,255,255,255], 0, 1, 2, 1);
stack.buffer();typecan be'rgb'or'rgba'. Defaults torgb.
- Inserts the
datapixel buffer at the coordinatesx,y datacan be anyArray-like datastructure (Buffer,ArrayBuffer).stridecan be aNumberrepresenting the size in bytes of each row, in case there's byte padding.- Returns the
PixelStackinstance.
- Sets the given
datapixel buffer as background color. - If not called, it'll default to filling with black (
0,0,0) upon the first call topushorbuffer. - Returns the
PixelStackinstance.
- Returns the
widthof the stack. Useful when not specified in the constructor and calculated dynamically.
- Returns the
heightof the stack. Useful when not specified in the constructor and calculated dynamically.
- Returns the calculated pixel
Buffer.
- Cleans the internal buffer.
Inspired by the FixedJpegStack and DynamicJpegStack interfaces of
the node-jpeg project by @pkrumins.
- Nick Momrik (@nickmomrik)
- Guillermo Rauch (@guille)
MIT – Copyright (c) 2014 Automattic, Inc.