canvas-prebuilt
Advanced tools
Comparing version 2.0.0-alpha.13 to 2.0.0-alpha.14
@@ -87,2 +87,5 @@ # Changelog | ||
* "source" is now "copy" | ||
* Provide better, Node.js core-style coded errors for failed sys calls. (For | ||
example, provide an error with code 'ENOENT' if setting `img.src` to a path | ||
that does not exist.) | ||
@@ -111,2 +114,7 @@ ### Added | ||
* Support for `img.src = <url>` to match browsers | ||
* Support reading data URL on `img.src` | ||
* Readme: add dependencies command for OpenBSD | ||
* Throw error if calling jpegStream when canvas was not built with JPEG support | ||
* Emit error if trying to load GIF, SVG or JPEG image when canvas was not built | ||
with support for that format | ||
@@ -113,0 +121,0 @@ 1.6.x (unreleased) |
@@ -28,23 +28,2 @@ 'use strict'; | ||
/** | ||
* Enable or disable image smoothing. | ||
* | ||
* @api public | ||
*/ | ||
Context2d.prototype.__defineSetter__('imageSmoothingEnabled', function(val){ | ||
this._imageSmoothing = !! val; | ||
this.patternQuality = val ? 'best' : 'fast'; | ||
}); | ||
/** | ||
* Get image smoothing value. | ||
* | ||
* @api public | ||
*/ | ||
Context2d.prototype.__defineGetter__('imageSmoothingEnabled', function(val){ | ||
return !! this._imageSmoothing; | ||
}); | ||
/** | ||
* Create a pattern from `Image` or `Canvas`. | ||
@@ -51,0 +30,0 @@ * |
@@ -16,2 +16,3 @@ 'use strict'; | ||
const http = require("http") | ||
const https = require("https") | ||
@@ -35,5 +36,6 @@ Object.defineProperty(Image.prototype, 'src', { | ||
const isBase64 = val.lastIndexOf('base64', commaI) | ||
val = val.slice(commaI + 1) | ||
this.source = Buffer.from(val, isBase64 ? 'base64' : 'utf8') | ||
} else if (/^\s*http/.test(val)) { // remote URL | ||
const content = val.slice(commaI + 1) | ||
this.source = Buffer.from(content, isBase64 ? 'base64' : 'utf8') | ||
this._originalSource = val | ||
} else if (/^\s*https?:\/\//.test(val)) { // remote URL | ||
const onerror = err => { | ||
@@ -46,3 +48,5 @@ if (typeof this.onerror === 'function') { | ||
} | ||
http.get(val, res => { | ||
const type = /^\s*https:\/\//.test(val) ? https : http | ||
type.get(val, res => { | ||
if (res.statusCode !== 200) { | ||
@@ -55,2 +59,3 @@ return onerror(new Error(`Server responded with ${res.statusCode}`)) | ||
this.source = Buffer.concat(buffers) | ||
this._originalSource = undefined | ||
}) | ||
@@ -60,5 +65,7 @@ }).on('error', onerror) | ||
this.source = val | ||
this._originalSource = undefined | ||
} | ||
} else if (Buffer.isBuffer(val)) { | ||
this.source = val | ||
this._originalSource = undefined | ||
} | ||
@@ -69,4 +76,6 @@ }, | ||
// TODO https://github.com/Automattic/node-canvas/issues/118 | ||
return this.source; | ||
} | ||
return this._originalSource || this.source; | ||
}, | ||
configurable: true | ||
}); | ||
@@ -73,0 +82,0 @@ |
@@ -37,2 +37,6 @@ 'use strict'; | ||
if (canvas.streamJPEGSync === undefined) { | ||
throw new Error("node-canvas was built without JPEG support."); | ||
} | ||
Readable.call(this); | ||
@@ -39,0 +43,0 @@ |
{ | ||
"_from": "canvas@2.0.0-alpha.13", | ||
"_id": "canvas@2.0.0-alpha.13", | ||
"_from": "canvas@2.0.0-alpha.14", | ||
"_id": "canvas@2.0.0-alpha.14", | ||
"_inBundle": false, | ||
"_integrity": "sha512-G4cZbYFzR+KrTJaj7BF5sOTMDwdyiKDYfhaTHchRpUOpGu2LFez3qP29B/bDmjQGy72Fi86RaQGH7H/ejrx41g==", | ||
"_integrity": "sha512-f2sKUAH8CJx6zxwzL29rwgeOo7E6ioPL0SPudEb1tequNfzRolcQtDYEFKtipRpfKPN9foOub2GDihH3KL1X6w==", | ||
"_location": "/canvas", | ||
"_phantomChildren": { | ||
"mkdirp": "0.5.1", | ||
"needle": "2.2.1", | ||
"needle": "2.2.3", | ||
"nopt": "4.0.1", | ||
@@ -15,3 +15,3 @@ "npm-packlist": "1.1.11", | ||
"rimraf": "2.6.2", | ||
"semver": "5.5.0", | ||
"semver": "5.5.1", | ||
"tar": "4.4.6" | ||
@@ -22,8 +22,8 @@ }, | ||
"registry": true, | ||
"raw": "canvas@2.0.0-alpha.13", | ||
"raw": "canvas@2.0.0-alpha.14", | ||
"name": "canvas", | ||
"escapedName": "canvas", | ||
"rawSpec": "2.0.0-alpha.13", | ||
"rawSpec": "2.0.0-alpha.14", | ||
"saveSpec": null, | ||
"fetchSpec": "2.0.0-alpha.13" | ||
"fetchSpec": "2.0.0-alpha.14" | ||
}, | ||
@@ -34,5 +34,5 @@ "_requiredBy": [ | ||
], | ||
"_resolved": "https://registry.npmjs.org/canvas/-/canvas-2.0.0-alpha.13.tgz", | ||
"_shasum": "c670de1ab6a33efab9ce5f63663672cc2be70c9f", | ||
"_spec": "canvas@2.0.0-alpha.13", | ||
"_resolved": "https://registry.npmjs.org/canvas/-/canvas-2.0.0-alpha.14.tgz", | ||
"_shasum": "021d81d76966ccfc7c72e7b0ac4c1d55779d92ff", | ||
"_spec": "canvas@2.0.0-alpha.14", | ||
"_where": "/Users/caleb/Code/node-canvas-prebuilt", | ||
@@ -111,3 +111,3 @@ "author": { | ||
}, | ||
"version": "2.0.0-alpha.13" | ||
"version": "2.0.0-alpha.14" | ||
} |
@@ -46,7 +46,8 @@ # node-canvas | ||
----- | ----- | ||
OS X | Using [Homebrew](https://brew.sh/):<br/>`brew install pkg-config cairo pango libpng jpeg giflib`<br/><br/>Using [MacPorts](https://www.macports.org/):<br/>`port install pkgconfig cairo pango libpng jpeg giflib` | ||
OS X | Using [Homebrew](https://brew.sh/):<br/>`brew install pkg-config cairo pango libpng jpeg giflib`<br/><br/>Using [MacPorts](https://www.macports.org/):<br/>`port install pkgconfig cairo pango libpng jpeg giflib libsrvg` | ||
Ubuntu | `sudo apt-get install libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev build-essential g++` | ||
Fedora | `sudo yum install cairo cairo-devel cairomm-devel libjpeg-turbo-devel pango pango-devel pangomm pangomm-devel giflib-devel` | ||
Solaris | `pkgin install cairo pango pkg-config xproto renderproto kbproto xextproto` | ||
Windows | [Instructions on our wiki](https://github.com/Automattic/node-canvas/wiki/Installation---Windows) | ||
OpenBSD | `doas pkg_add cairo pango png jpeg giflib` | ||
Windows | [Instructions on our wiki](https://github.com/Automattic/node-canvas/wiki/Installation:-Windows) | ||
@@ -181,3 +182,3 @@ **Mac OS X v10.11+:** If you have recently updated to Mac OS X v10.11+ and are experiencing trouble when compiling, run the following command: `xcode-select --install`. Read more about the problem [on Stack Overflow](http://stackoverflow.com/a/32929012/148072). | ||
All properties are optional. | ||
Note that the PNG format encodes the resolution in pixels per meter, so if | ||
@@ -184,0 +185,0 @@ you specify `96`, the file will encode 3780 ppm (~96.01 ppi). The resolution |
{ | ||
"name": "canvas-prebuilt", | ||
"description": "Prebuilt versions of node-canvas as a drop-in replacement", | ||
"version": "2.0.0-alpha.13", | ||
"version": "2.0.0-alpha.14", | ||
"author": "Caleb Hearon <crh0872@gmail.com>", | ||
@@ -33,6 +33,6 @@ "browser": "canvas/browser.js", | ||
"dependencies": { | ||
"node-pre-gyp": "^0.10.0", | ||
"detect-libc": "^1.0.3", | ||
"nan": "^2.9.2", | ||
"detect-libc": "^1.0.3" | ||
"node-pre-gyp": "^0.10.0" | ||
} | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
347988
83
1590
8