Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

canvas

Package Overview
Dependencies
Maintainers
6
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

canvas - npm Package Compare versions

Comparing version 2.0.0-alpha.13 to 2.0.0-alpha.14

src/CanvasError.h

8

CHANGELOG.md

@@ -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)

21

lib/context2d.js

@@ -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 @@ *

21

lib/image.js

@@ -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 @@

{
"name": "canvas",
"description": "Canvas graphics API backed by Cairo",
"version": "2.0.0-alpha.13",
"version": "2.0.0-alpha.14",
"author": "TJ Holowaychuk <tj@learnboost.com>",

@@ -6,0 +6,0 @@ "main": "index.js",

@@ -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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc