Browse Source

Removed buffer utils

v1.x
Tj Holowaychuk 14 years ago
parent
commit
5ae2c57753
  1. 22
      lib/buffer.js
  2. 26
      lib/canvas.js

22
lib/buffer.js

@ -1,22 +0,0 @@
/*!
* Canvas - Buffer
* Copyright (c) 2010 LearnBoost <tj@learnboost.com>
* MIT Licensed
*/
/**
* Concatenate `this` Buffer with `other`.
*
* @param {Buffer} other
* @return {Buffer}
* @api public
*/
Buffer.prototype.concat = function(other) {
var len = this.length
, buf = new Buffer(len + other.length);
this.copy(buf, 0, 0);
other.copy(buf, len, 0);
return buf;
};

26
lib/canvas.js

@ -41,12 +41,6 @@ exports.cairoVersion = cairoVersion;
exports.Context2d = Context2d;
exports.PNGStream = PNGStream;
/**
* Buffer extensions.
*/
require('./buffer');
/**
* Context2d implementation.
*/
@ -103,26 +97,6 @@ Canvas.prototype.createSyncPNGStream = function(){
return new PNGStream(this, true);
};
/**
* Return a `Buffer` instance consisting of the PNG image data.
*
* @return {Buffer}
* @api public
*/
Canvas.prototype.toBuffer = function(){
var buf;
this.streamPNGSync(function(err, chunk, len){
if (err) throw err;
if (len) {
buf = buf
? buf.concat(chunk)
: chunk;
}
});
return buf;
};
/**
* Return a data url.
*

Loading…
Cancel
Save