Prebuilt module for commit 6c5f1dc671

This commit is contained in:
Paper.js Bot 2017-10-04 20:44:14 +00:00
parent cb95b131a0
commit 579179a517
7 changed files with 23 additions and 18 deletions

View file

@ -9,7 +9,7 @@
*
* All rights reserved.
*
* Date: Wed Oct 4 21:43:56 2017 +0200
* Date: Wed Oct 4 22:39:19 2017 +0200
*
***
*

17
dist/node/canvas.js vendored
View file

@ -13,7 +13,7 @@
// Add some useful extensions to HTMLCanvasElement:
// - HTMLCanvasElement#type, so we can switch to a PDF canvas
// - Various Node-Canvas methods, routed through from HTMLCanvasElement:
// toBuffer, pngStream, createPNGStream, jpgStream, createJPGStream
// toBuffer, pngStream, createPNGStream, jpegStream, createJPEGStream
module.exports = function(self, requireName) {
var Canvas;
@ -55,11 +55,12 @@ module.exports = function(self, requireName) {
});
// Extend HTMLCanvasElement with useful methods from the underlying Canvas:
['toBuffer', 'pngStream', 'createPNGStream', 'jpgStream', 'createJPGStream']
.forEach(function(key) {
HTMLCanvasElement.prototype[key] = function() {
var canvas = idlUtils.implForWrapper(this)._canvas;
return canvas[key].apply(canvas, arguments);
};
});
var methods = ['toBuffer', 'pngStream', 'createPNGStream', 'jpegStream',
'createJPEGStream'];
methods.forEach(function(key) {
HTMLCanvasElement.prototype[key] = function() {
var canvas = idlUtils.implForWrapper(this)._canvas;
return canvas[key].apply(canvas, arguments);
};
});
};

14
dist/node/extend.js vendored
View file

@ -67,7 +67,7 @@ module.exports = function(paper) {
},
/**
* @deprecated use use {@link #createCanvas(width, height)} instead.
* @deprecated, use use {@link #createCanvas(width, height)} instead.
*/
Canvas: '#createCanvas'
});
@ -87,9 +87,12 @@ module.exports = function(paper) {
fps: 30,
prefix: 'frame-',
amount: 1,
format: 'png' // Supported: 'png' or 'jpeg'
}, options);
if (!options.directory)
throw new Error('Missing options.directory');
if (options.format && !/^(jpeg|png)$/.test(options.format))
throw new Error('Unsupported format. Use "png" or "jpeg"');
var view = this,
count = 0,
frameDuration = 1 / options.fps,
@ -108,8 +111,9 @@ module.exports = function(paper) {
time: frameDuration * count,
count: count
}));
var file = path.join(options.directory, options.prefix +
(paddedStr + count).slice(-padding) + '.png');
var file = path.join(options.directory,
options.prefix + (paddedStr + count).slice(-padding)
+ '.' + options.format);
var out = view.exportImage(file, function() {
// Once the file has been closed, export the next fame:
var then = Date.now();
@ -140,8 +144,8 @@ module.exports = function(paper) {
exportImage: function(path, callback) {
this.update();
var out = fs.createWriteStream(path),
stream = this._element.createPNGStream();
// Pipe the png stream to the write stream:
format = /\.jp(e?)g$/.test(path) ? 'jpeg' : 'png'
stream = this._element[format + 'Stream']();
stream.pipe(out);
if (callback) {
out.on('close', callback);

2
dist/paper-core.js vendored
View file

@ -9,7 +9,7 @@
*
* All rights reserved.
*
* Date: Wed Oct 4 21:43:56 2017 +0200
* Date: Wed Oct 4 22:39:19 2017 +0200
*
***
*

View file

@ -9,7 +9,7 @@
*
* All rights reserved.
*
* Date: Wed Oct 4 21:43:56 2017 +0200
* Date: Wed Oct 4 22:39:19 2017 +0200
*
***
*

2
dist/paper-full.js vendored
View file

@ -9,7 +9,7 @@
*
* All rights reserved.
*
* Date: Wed Oct 4 21:43:56 2017 +0200
* Date: Wed Oct 4 22:39:19 2017 +0200
*
***
*

View file

@ -9,7 +9,7 @@
*
* All rights reserved.
*
* Date: Wed Oct 4 21:43:56 2017 +0200
* Date: Wed Oct 4 22:39:19 2017 +0200
*
***
*