Socket
Socket
Sign inDemoInstall

canvas-prebuilt

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

canvas-prebuilt - npm Package Compare versions

Comparing version 1.6.5-prerelease.1 to 2.0.0-alpha.1

canvas/src/backend/Backend.cc

24

canvas/History.md

@@ -1,26 +0,6 @@

1.6.5 / 2017-03-18
Unreleased / patch
==================
* Parse font using parse-css-font and units-css (#891)
* Port has_lib.sh to javascript (#872)
1.6.4 / 2017-02-26
==================
* Make sure Canvas#toDataURL is always async if a callback is passed in (#874)
1.6.3 / 2017-02-14
==================
* Fix isnan() and isinf() on Clang (#864)
1.6.2 / 2016-10-30
==================
* Fix deprecation warnings (#835)
1.6.1 / 2016-10-23
==================
* Convert has_lib.sh to sh so it also works on BSD OSes (#820)
1.6.0 / 2016-10-16

@@ -27,0 +7,0 @@ ==================

@@ -14,2 +14,3 @@ 'use strict';

var canvas = require('./bindings')
, Backends = canvas.Backends
, Canvas = canvas.Canvas

@@ -22,3 +23,2 @@ , Image = canvas.Image

, JPEGStream = require('./jpegstream')
, FontFace = canvas.FontFace
, fs = require('fs')

@@ -34,2 +34,4 @@ , packageJson = require("../package.json")

exports.backends = Backends;
/**

@@ -82,25 +84,10 @@ * Library version.

if (FontFace) {
var Font = function Font(name, path, idx) {
this.name = name;
this._faces = {};
/**
* Resolve paths for registerFont
*/
this.addFace(path, 'normal', 'normal', idx);
};
Canvas.registerFont = function(src, fontFace){
return Canvas._registerFont(fs.realpathSync(src), fontFace);
};
Font.prototype.addFace = function(path, weight, style, idx) {
style = style || 'normal';
weight = weight || 'normal';
var face = new FontFace(path, idx || 0);
this._faces[weight + '-' + style] = face;
};
Font.prototype.getFace = function(weightStyle) {
return this._faces[weightStyle] || this._faces['normal-normal'];
};
exports.Font = Font;
}
/**

@@ -107,0 +94,0 @@ * Context2d implementation.

@@ -91,3 +91,3 @@ 'use strict';

unit: size.unit,
family: parsedFont.family[0]
family: parsedFont.family.join(',')
};

@@ -235,15 +235,2 @@

/**
* Register `font` for usage.
*
* @param {Font} font
* @api public
*/
Context2d.prototype.addFont = function(font) {
this._fonts = this._fonts || {};
if (this._fonts[font.name]) return;
this._fonts[font.name] = font;
};
/**
* Set font.

@@ -261,18 +248,8 @@ *

this.lastFontString = val;
var fonts = this._fonts;
if (fonts && fonts[font.family]) {
var fontObj = fonts[font.family];
var type = font.weight + '-' + font.style;
var fontFace = fontObj.getFace(type);
this._setFontFace(fontFace, font.size);
} else {
this._setFont(
font.weight
, font.style
, font.size
, font.unit
, font.family);
}
this._setFont(
font.weight
, font.style
, font.size
, font.unit
, font.family);
}

@@ -279,0 +256,0 @@ }

@@ -13,3 +13,4 @@ 'use strict';

var Stream = require('stream').Stream;
var Readable = require('stream').Readable;
var util = require('util');

@@ -34,4 +35,10 @@ /**

var JPEGStream = module.exports = function JPEGStream(canvas, options, sync) {
var self = this
, method = sync
if (!(this instanceof JPEGStream)) {
throw new TypeError("Class constructors cannot be invoked without 'new'");
}
Readable.call(this);
var self = this;
var method = sync
? 'streamJPEGSync'

@@ -42,15 +49,29 @@ : 'streamJPEG';

this.canvas = canvas;
this.readable = true;
// TODO: implement async
if ('streamJPEG' == method) method = 'streamJPEGSync';
this.method = method;
};
util.inherits(JPEGStream, Readable);
function noop() {}
JPEGStream.prototype._read = function _read() {
// For now we're not controlling the c++ code's data emission, so we only
// call canvas.streamJPEGSync once and let it emit data at will.
this._read = noop;
var self = this;
var method = this.method;
var bufsize = this.options.bufsize;
var quality = this.options.quality;
var progressive = this.options.progressive;
process.nextTick(function(){
canvas[method](options.bufsize, options.quality, options.progressive, function(err, chunk){
self.canvas[method](bufsize, quality, progressive, function(err, chunk){
if (err) {
self.emit('error', err);
self.readable = false;
} else if (chunk) {
self.emit('data', chunk);
self.push(chunk);
} else {
self.emit('end');
self.readable = false;
self.push(null);
}

@@ -60,7 +81,1 @@ });

};
/**
* Inherit from `EventEmitter`.
*/
JPEGStream.prototype.__proto__ = Stream.prototype;

@@ -11,3 +11,4 @@ 'use strict';

var Stream = require('stream').Stream;
var Readable = require('stream').Readable;
var util = require('util');

@@ -32,2 +33,8 @@ /**

var PDFStream = module.exports = function PDFStream(canvas, sync) {
if (!(this instanceof PDFStream)) {
throw new TypeError("Class constructors cannot be invoked without 'new'");
}
Readable.call(this);
var self = this

@@ -39,15 +46,25 @@ , method = sync

this.canvas = canvas;
this.readable = true;
// TODO: implement async
if ('streamPDF' == method) method = 'streamPDFSync';
this.method = method;
};
util.inherits(PDFStream, Readable);
function noop() {}
PDFStream.prototype._read = function _read() {
// For now we're not controlling the c++ code's data emission, so we only
// call canvas.streamPDFSync once and let it emit data at will.
this._read = noop;
var self = this;
process.nextTick(function(){
canvas[method](function(err, chunk, len){
self.canvas[self.method](function(err, chunk, len){
if (err) {
self.emit('error', err);
self.readable = false;
} else if (len) {
self.emit('data', chunk, len);
self.push(chunk);
} else {
self.emit('end');
self.readable = false;
self.push(null);
}

@@ -57,7 +74,1 @@ });

};
/**
* Inherit from `EventEmitter`.
*/
PDFStream.prototype.__proto__ = Stream.prototype;

@@ -13,3 +13,4 @@ 'use strict';

var Stream = require('stream').Stream;
var Readable = require('stream').Readable;
var util = require('util');

@@ -34,4 +35,10 @@ /**

var PNGStream = module.exports = function PNGStream(canvas, sync) {
var self = this
, method = sync
if (!(this instanceof PNGStream)) {
throw new TypeError("Class constructors cannot be invoked without 'new'");
}
Readable.call(this);
var self = this;
var method = sync
? 'streamPNGSync'

@@ -41,15 +48,42 @@ : 'streamPNG';

this.canvas = canvas;
this.readable = true;
// TODO: implement async
if ('streamPNG' == method) method = 'streamPNGSync';
if ('streamPNG' === method) method = 'streamPNGSync';
this.method = method;
};
util.inherits(PNGStream, Readable);
var PNGStream = module.exports = function PNGStream(canvas, sync) {
Readable.call(this);
var self = this;
var method = sync
? 'streamPNGSync'
: 'streamPNG';
this.sync = sync;
this.canvas = canvas;
// TODO: implement async
if ('streamPNG' === method) method = 'streamPNGSync';
this.method = method;
};
util.inherits(PNGStream, Readable);
function noop() {}
PNGStream.prototype._read = function _read() {
// For now we're not controlling the c++ code's data emission, so we only
// call canvas.streamPNGSync once and let it emit data at will.
this._read = noop;
var self = this;
process.nextTick(function(){
canvas[method](function(err, chunk, len){
self.canvas[self.method](function(err, chunk, len){
if (err) {
self.emit('error', err);
self.readable = false;
} else if (len) {
self.emit('data', chunk, len);
self.push(chunk);
} else {
self.emit('end');
self.readable = false;
self.push(null);
}

@@ -59,7 +93,1 @@ });

};
/**
* Inherit from `EventEmitter`.
*/
PNGStream.prototype.__proto__ = Stream.prototype;

@@ -5,8 +5,8 @@ {

{
"raw": "canvas@1.6.5",
"raw": "canvas@2.0.0-alpha.1",
"scope": null,
"escapedName": "canvas",
"name": "canvas",
"rawSpec": "1.6.5",
"spec": "1.6.5",
"rawSpec": "2.0.0-alpha.1",
"spec": "2.0.0-alpha.1",
"type": "version"

@@ -17,10 +17,10 @@ },

],
"_from": "canvas@1.6.5",
"_id": "canvas@1.6.5",
"_from": "canvas@2.0.0-alpha.1",
"_id": "canvas@2.0.0-alpha.1",
"_inCache": true,
"_location": "/canvas",
"_nodeVersion": "7.6.0",
"_nodeVersion": "7.9.0",
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/canvas-1.6.5.tgz_1489832623269_0.8676735064946115"
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/canvas-2.0.0-alpha.1.tgz_1493849200728_0.11173344543203712"
},

@@ -31,3 +31,3 @@ "_npmUser": {

},
"_npmVersion": "4.1.2",
"_npmVersion": "4.2.0",
"_phantomChildren": {

@@ -47,8 +47,8 @@ "css-font-size-keywords": "1.0.0",

"_requested": {
"raw": "canvas@1.6.5",
"raw": "canvas@2.0.0-alpha.1",
"scope": null,
"escapedName": "canvas",
"name": "canvas",
"rawSpec": "1.6.5",
"spec": "1.6.5",
"rawSpec": "2.0.0-alpha.1",
"spec": "2.0.0-alpha.1",
"type": "version"

@@ -59,6 +59,6 @@ },

],
"_resolved": "https://registry.npmjs.org/canvas/-/canvas-1.6.5.tgz",
"_shasum": "557f9988f5d2c95fdc247c61a5ee43de52f6717c",
"_resolved": "https://registry.npmjs.org/canvas/-/canvas-2.0.0-alpha.1.tgz",
"_shasum": "ea6731156415fc72065d153321153f62f2ea7b7e",
"_shrinkwrap": null,
"_spec": "canvas@1.6.5",
"_spec": "canvas@2.0.0-alpha.1",
"_where": "/Users/caleb/Code/node-canvas-prebuilt",

@@ -93,17 +93,15 @@ "author": {

"devDependencies": {
"body-parser": "^1.13.3",
"express": "^4.13.2",
"mocha": "*",
"pug": "^2.0.0-beta3",
"standard": "^7.1.1"
"express": "^4.14.0",
"mocha": "^3.1.2",
"standard": "^8.5.0"
},
"directories": {},
"dist": {
"shasum": "557f9988f5d2c95fdc247c61a5ee43de52f6717c",
"tarball": "https://registry.npmjs.org/canvas/-/canvas-1.6.5.tgz"
"shasum": "ea6731156415fc72065d153321153f62f2ea7b7e",
"tarball": "https://registry.npmjs.org/canvas/-/canvas-2.0.0-alpha.1.tgz"
},
"engines": {
"node": ">=0.8.0"
"node": ">=4"
},
"gitHead": "451e6da9ba30888c08e33f16a7aedbc9425c753a",
"gitHead": "6b72722ca65013e4303769e5551aa877fd5d92b4",
"gypfile": true,

@@ -162,6 +160,6 @@ "homepage": "https://github.com/Automattic/node-canvas",

"pretest-server": "node-gyp build",
"test": "standard examples/*.js && mocha test/*.test.js",
"test": "standard examples/*.js test/server.js test/public/*.js benchmark/run.js util/has_lib.js && mocha test/*.test.js",
"test-server": "node test/server.js"
},
"version": "1.6.5"
"version": "2.0.0-alpha.1"
}

@@ -1,3 +0,11 @@

node-canvas
===========
# node-canvas
-----
## This is the documentation for the unreleased version 2.0
**For the current version 1.x documentation, see [the v1.x branch](https://github.com/Automattic/node-canvas/tree/v1.x)**
-----
### Canvas graphics API backed by Cairo

@@ -22,4 +30,6 @@ [![Build Status](https://travis-ci.org/Automattic/node-canvas.svg?branch=master)](https://travis-ci.org/Automattic/node-canvas)

Unless previously installed you'll _need_ __Cairo__. For system-specific installation view the [Wiki](https://github.com/Automattic/node-canvas/wiki/_pages).
Unless previously installed you'll _need_ __Cairo__ and __Pango__. For system-specific installation view the [Wiki](https://github.com/Automattic/node-canvas/wiki/_pages).
Currently the minimum version of node required is __4.0.0__
You can quickly install the dependencies by using the command for your OS:

@@ -29,6 +39,6 @@

----- | -----
OS X | `brew install pkg-config cairo libpng jpeg giflib`
OS X | `brew install pkg-config cairo pango libpng jpeg giflib`
Ubuntu | `sudo apt-get install libcairo2-dev libjpeg8-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 pkg-config xproto renderproto kbproto xextproto`
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)

@@ -187,2 +197,22 @@

### Canvas.registerFont for bundled fonts
It can be useful to use a custom font file if you are distributing code that uses node-canvas and a specific font. Or perhaps you are using it to do automated tests and you want the renderings to be the same across operating systems regardless of what fonts are installed.
To do that, you should use `Canvas.registerFont`.
**You need to call it before the Canvas is created**
```javascript
Canvas.registerFont('comicsans.ttf', {family: 'Comic Sans'});
var canvas = new Canvas(500, 500),
ctx = canvas.getContext('2d');
ctx.font = '12px "Comic Sans"';
ctx.fillText(250, 10, 'Everyone hates this font :(');
```
The second argument is an object with properties that resemble the CSS properties that are specified in `@font-face` rules. You must specify at least `family`. `weight`, and `style` are optional (and default to "normal").
### CanvasRenderingContext2D#patternQuality

@@ -316,12 +346,2 @@

## Versions
Tested with and designed for:
- node 0.4.2
- cairo 1.8.6
For node 0.2.x `node-canvas` <= 0.4.3 may be used,
0.5.0 and above are designed for node 0.4.x only.
## License

@@ -328,0 +348,0 @@

{
"name": "canvas-prebuilt",
"description": "Prebuilt versions of node-canvas as a drop-in replacement",
"version": "1.6.5-prerelease.1",
"version": "2.0.0-alpha.1",
"author": "Caleb Hearon <crh0872@gmail.com>",

@@ -17,3 +17,3 @@ "keywords": [

"scripts": {
"install": "node_modules/.bin/node-pre-gyp install",
"install": "node-pre-gyp install",
"test": "echo No test needed"

@@ -33,2 +33,3 @@ },

"node-pre-gyp": "^0.6.29",
"nan": "^2.4.0",
"parse-css-font": "^2.0.2",

@@ -35,0 +36,0 @@ "units-css": "^0.4.0"

@@ -7,2 +7,4 @@ [![NPM version](https://badge.fury.io/js/canvas-prebuilt.svg)](http://badge.fury.io/js/canvas-prebuilt)

You will also need to change `require('canvas')` to `require('canvas-prebuilt')`.
The repo is just a set of scripts that downloads a specific node-canvas version, builds it

@@ -20,10 +22,10 @@ and bundles it on all platforms. It's meant to run on Travis and AppVeyor but it can

| canvas@1.4.x<br>canvas@1.5.x<br>canvas@1.6.x | node 7 | node 6 | node 5 | node 4 | node 0.12 | node 0.10 |
| ------------ | ------ | ------ | ------ | ------ | --------- | --------- |
| Linux x64 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Windows x64 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| OSX x64 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Windows x86 | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ |
| Linux x86 | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ |
| Linux ARM | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ |
| canvas@1.4.x<br>canvas@1.5.x<br>canvas@1.6.x<br>canvas@2.0.0-alpha.1 | node 8 | node 7 | node 6 | node 5 | node 4 | node 0.12 | node 0.10 |
| ------------------ | ------ | ------ | ------ | ------ | ------ | --------- | --------- |
| Linux x64 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Windows x64 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| OSX x64 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Windows x86 | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ |
| Linux x86 | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ |
| Linux ARM | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ | 𐄂¹ |

@@ -33,17 +35,2 @@ ¹I have some ideas on how to get these working with cross-compilation if people request it.

## Canvas version mapping
I screwed up and had to unpublish a couple of versions so they aren't 1:1 with canvas. If you have the minor or major version fixed it should not matter.
| canvas | canvas-prebuilt |
| ------ | --------------- |
| 1.4.0 | 1.4.0 |
| 1.5.0 | 1.5.0 |
| 1.6.0 | 1.6.0 |
| 1.6.1 | 1.6.3 |
| 1.6.2 | 1.6.4         |
| 1.6.3 | 1.6.5 |
| 1.6.4 | 1.6.6 |
| 1.6.5 | 1.6.7 |
# Bundling

@@ -50,0 +37,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

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

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