@scratch/paper
Advanced tools
Comparing version 0.11.6 to 0.11.20171204223652
@@ -16,1 +16,2 @@ ## Authors | ||
- Scott Kieronski <baroes0239@gmail.com> | ||
- DD Liu <liudi@media.mit.edu> |
@@ -16,3 +16,3 @@ /* | ||
// - Various Node-Canvas methods, routed through from HTMLCanvasElement: | ||
// toBuffer, pngStream, createPNGStream, jpgStream, createJPGStream | ||
// toBuffer, pngStream, createPNGStream, jpegStream, createJPEGStream | ||
@@ -59,9 +59,10 @@ 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); | ||
}; | ||
}); | ||
}; |
@@ -70,3 +70,3 @@ /* | ||
/** | ||
* @deprecated use use {@link #createCanvas(width, height)} instead. | ||
* @deprecated, use use {@link #createCanvas(width, height)} instead. | ||
*/ | ||
@@ -91,5 +91,8 @@ Canvas: '#createCanvas' | ||
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, | ||
@@ -113,4 +116,5 @@ count = 0, | ||
})); | ||
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() { | ||
@@ -146,4 +150,4 @@ // Once the file has been closed, export the next fame: | ||
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); | ||
@@ -150,0 +154,0 @@ if (callback) { |
{ | ||
"name": "@scratch/paper", | ||
"version": "0.11.6", | ||
"version": "0.11.20171204223652", | ||
"description": "The Swiss Army Knife of Vector Graphics Scripting", | ||
@@ -41,3 +41,3 @@ "license": "MIT", | ||
"acorn": "~0.5.0", | ||
"canvas": "^1.3.5", | ||
"canvas-prebuilt": "^1.6.5-prerelease.1", | ||
"del": "^2.2.1", | ||
@@ -44,0 +44,0 @@ "gulp": "^3.9.1", |
@@ -283,4 +283,4 @@ # Paper.js - The Swiss Army Knife of Vector Graphics Scripting [![Build Status](https://travis-ci.org/paperjs/paper.js.svg?branch=develop)](https://travis-ci.org/paperjs/paper.js) [![NPM](https://img.shields.io/npm/v/paper.svg)](https://www.npmjs.com/package/paper) ![Bower](https://img.shields.io/bower/v/paper.svg) | ||
We prefer that you send a [pull request on GitHub] | ||
(http://help.github.com/pull-requests/) which will then be merged into the | ||
We prefer that you send a [pull request on GitHub | ||
](http://help.github.com/pull-requests/) which will then be merged into the | ||
official main line repository. You need to sign the Paper.js CLA to be able to | ||
@@ -356,8 +356,8 @@ contribute (see below). | ||
For a list of authors and contributors, please see [AUTHORS] | ||
(https://github.com/paperjs/paper.js/blob/master/AUTHORS.md). | ||
For a list of authors and contributors, please see [AUTHORS | ||
](https://github.com/paperjs/paper.js/blob/master/AUTHORS.md). | ||
## License | ||
Distributed under the MIT license. See [LICENSE] | ||
(https://github.com/paperjs/paper.js/blob/master/LICENSE.txt) for details. | ||
Distributed under the MIT license. See [LICENSE | ||
](https://github.com/paperjs/paper.js/blob/master/LICENSE.txt) for details. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
7263694
182
47462
3
9
7