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

canvas

Package Overview
Dependencies
Maintainers
0
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 0.0.7 to 0.3.2

node-canvas/._install

6

node-canvas/._History.md

@@ -1,4 +0,4 @@

Mac OS X  2��ATTR����"�"com.macromates.caret{
column = 10;
line = 4;
Mac OS X  2��ATTRѸ���"�"com.macromates.caret{
column = 0;
line = 11;
}

@@ -1,4 +0,4 @@

Mac OS X  2��ATTR�����"�"com.macromates.caret{
Mac OS X  2��ATTR�7��"�"com.macromates.caret{
column = 21;
line = 2;
}

@@ -1,4 +0,4 @@

Mac OS X  2��ATTR�`^��$�$com.macromates.caret{
column = 136;
line = 13;
Mac OS X  2��ATTR�����$�$com.macromates.caret{
column = 205;
line = 60;
}
0.3.2 / 2010-11-26
==================
* Added --profile option to config
* Fixed `eio_custom` segfault(s). Closes #46
* Fixed two named colors. Closes #62 [thanks noonat]
* Fixed a few warnings
* Fixed; freeing data in `Image::loadJPEG()` on failure
* Fixed; include _jpeglib_ only when __HAVE_JPEG__
* Fixed; using `strstr()` instead of `strnstr()`
0.3.1 / 2010-11-24
==================
* Fixed; `Image` loading is sync until race-condition is resolved
* Fixed; `Image::loadJPEG()` return status based on errno
0.3.0 / 2010-11-24
==================
* Added arcTo(). Closes #11
* Added c color parser, _./examples/ray.js_ is now twice as fast
* Fixed `putImageData()` bug messing up rgba channels
0.2.1 / 2010-11-19
==================
* Added image _resize_ example
* Fixed canvas resizing via `{width,height}=`. Closes #57
* Fixed `Canvas#getContext()`, caching the CanvasRenderingContext
* Fixed async image loading (test server still messed)
0.2.0 / 2010-11-18
==================
* Added jpeg `Image` support (when libjpeg is available)
* Added _hsl_ / _hsla_ color support. [Tom Carden]
0.1.0 / 2010-11-17
==================
* Added `Image`
* Added `ImageData`
* Added `PixelArray`
* Added `CanvasRenderingContext2d#drawImage()`
* Added `CanvasRenderingContext2d#getImageData()`
* Added `CanvasRenderingContext2d#createImageData()`
* Added kraken blur benchmark example
* Added several new tests
* Fixed instanceof checks for many c++ methods
* Fixed test runner in firefox [Don Park]
0.0.8 / 2010-11-12
==================
* Added `CanvasRenderingContext2d#drawImage()`
* Fixed `free()` call missing stdlib
* Fixed Image#{width,height} initialization to 0
* Fixed; load image on non-LOADING state
0.0.7 / 2010-11-12

@@ -3,0 +63,0 @@ ==================

@@ -1,4 +0,4 @@

Mac OS X  2��ATTR�����#�#com.macromates.caret{
Mac OS X  2��ATTR�6��#�#com.macromates.caret{
column = 24;
line = 29;
line = 30;
}

@@ -1,1 +0,1 @@

Mac OS X  2��ATTR� �� � com.macromates.caretx���R������<[k0?'3/«��
Mac OS X  2��ATTR���� � com.macromates.caretx���R������<[k0?'3/«��

@@ -16,2 +16,3 @@

, cairoVersion = canvas.cairoVersion
, PixelArray = canvas.PixelArray
, Context2d = require('./context2d')

@@ -31,3 +32,3 @@ , PNGStream = require('./pngstream')

exports.version = '0.0.7';
exports.version = '0.3.2';

@@ -46,2 +47,3 @@ /**

exports.PNGStream = PNGStream;
exports.PixelArray = PixelArray;
exports.Image = Image;

@@ -62,2 +64,8 @@

/**
* PixelArray implementation.
*/
require('./pixelarray');
/**
* Inspect canvas.

@@ -83,3 +91,3 @@ *

if ('2d' == contextId) {
var ctx = new Context2d(this);
var ctx = this._context2d || (this._context2d = new Context2d(this));
this.context = ctx;

@@ -86,0 +94,0 @@ ctx.canvas = this;

@@ -15,3 +15,4 @@

, CanvasGradient = canvas.CanvasGradient
, colors = require('./colors');
, ImageData = canvas.ImageData
, PixelArray = canvas.CanvasPixelArray;

@@ -57,30 +58,2 @@ /**

/**
* Return a function used to normalize an RGBA color `prop`
* or the pattern previously set.
*
* @param {String} prop
* @return {Function}
* @api private
*/
function getter(prop) {
return function(){
var val = this[prop];
if (val instanceof CanvasGradient) return val;
if (1 == val[3]) {
return '#'
+ val[0].toString(16)
+ val[1].toString(16)
+ val[2].toString(16);
} else {
return 'rgba('
+ val[0] + ', '
+ val[1] + ', '
+ val[2] + ', '
+ val[3] + ')';
}
}
}
/**
* Parse font `str`.

@@ -111,95 +84,2 @@ *

/**
* Parse the given color `str`.
*
* Current supports:
*
* - #nnn
* - #nnnnnn
* - rgb(r,g,b)
* - rgba(r,g,b,a)
* - color
*
* Examples
*
* - #fff
* - #FFF
* - #FFFFFF
* - rgb(255,255,5)
* - rgba(255,255,5,.8)
* - rgba(255,255,5,0.8)
* - white
* - red
*
* @param {String} str
* @return {Array}
* @api private
*/
var parseColor = exports.parseColor = function(str){
if (cache[str]) return cache[str];
str = colors[str] || String(str);
// RGBA
if (0 == str.indexOf('rgba')) {
var captures = /rgba\((\d{1,3}) *, *(\d{1,3}) *, *(\d{1,3}) *, *(\d+\.\d+|\.\d+|\d+) *\)/.exec(str);
if (!captures) return;
return cache[str] = [
parseInt(captures[1], 10)
, parseInt(captures[2], 10)
, parseInt(captures[3], 10)
, parseFloat(captures[4], 10)
];
// RGB
} else if (0 == str.indexOf('rgb')) {
var captures = /rgb\((\d{1,3}) *, *(\d{1,3}) *, *(\d{1,3}) *\)/.exec(str);
if (!captures) return;
return cache[str] = [
parseInt(captures[1], 10)
, parseInt(captures[2], 10)
, parseInt(captures[3], 10)
, 1
];
// #RRGGBB
} else if ('#' == str[0] && str.length > 4) {
var captures = /#([a-fA-F\d]{2})([a-fA-F\d]{2})([a-fA-F\d]{2})/.exec(str);
if (!captures) return;
return cache[str] = [
parseInt(captures[1], 16)
, parseInt(captures[2], 16)
, parseInt(captures[3], 16)
, 1
];
// #RGB
} else if ('#' == str[0]) {
var captures = /#([a-fA-F\d])([a-fA-F\d])([a-fA-F\d])/.exec(str);
if (!captures) return;
return cache[str] = [
parseInt(captures[1] + captures[1], 16)
, parseInt(captures[2] + captures[2], 16)
, parseInt(captures[3] + captures[3], 16)
, 1
];
}
};
/**
* Add `color` stop at the given `offset`.
*
* @param {Number} offset
* @param {String} color
* @api public
*/
CanvasGradient.prototype.addColorStop = function(offset, color){
var rgba;
if (rgba = parseColor(color)) {
this.addColorStopRGBA(
offset
, rgba[0]
, rgba[1]
, rgba[2]
, rgba[3]);
}
};
/**
* Create a linear gradient at the given point `(x0, y0)` and `(x1, y1)`.

@@ -252,3 +132,2 @@ *

*
* @see exports.parseColor()
* @api public

@@ -262,11 +141,3 @@ */

} else if ('string' == typeof val) {
var rgba;
if (rgba = parseColor(val)) {
this.lastFillStyle = rgba;
this.setFillRGBA(
rgba[0]
, rgba[1]
, rgba[2]
, rgba[3]);
}
this.setFillColor(val);
}

@@ -276,8 +147,11 @@ });

/**
* Get the current fill style string.
* Get previous fill style.
*
* @return {CanvasGradient|String}
* @api public
*/
Context2d.prototype.__defineGetter__('fillStyle', getter('lastFillStyle'));
Context2d.prototype.__defineGetter__('fillStyle', function(){
return this.lastFillStyle || this.fillColor;
});

@@ -287,3 +161,2 @@ /**

*
* @see exports.parseColor()
* @api public

@@ -297,11 +170,3 @@ */

} else if ('string' == typeof val) {
var rgba;
if (rgba = parseColor(val)) {
this.lastStrokeStyle = rgba;
this.setStrokeRGBA(
rgba[0]
, rgba[1]
, rgba[2]
, rgba[3]);
}
this.setStrokeColor(val);
}

@@ -311,38 +176,13 @@ });

/**
* Get the current stroke style string.
* Get previous stroke style.
*
* @return {CanvasGradient|String}
* @api public
*/
Context2d.prototype.__defineGetter__('strokeStyle', getter('lastStrokeStyle'));
/**
* Set the shadow color with the given css color string.
*
* @see exports.parseColor()
* @api public
*/
Context2d.prototype.__defineSetter__('shadowColor', function(val){
if ('string' == typeof val) {
var rgba;
if (rgba = parseColor(val)) {
this.lastShadowColor = rgba;
this.setShadowRGBA(
rgba[0]
, rgba[1]
, rgba[2]
, rgba[3]);
}
}
Context2d.prototype.__defineGetter__('strokeStyle', function(){
return this.lastStrokeStyle || this.strokeColor;
});
/**
* Get the current shadow color string.
*
* @api public
*/
Context2d.prototype.__defineGetter__('shadowColor', getter('lastShadowColor'));
/**

@@ -460,2 +300,36 @@ * Set font.

return this.lastTextAlignment || 'start';
});
});
/**
* Get `ImageData` with the given rect.
*
* @param {Number} x
* @param {Number} y
* @param {Number} width
* @param {Number} height
* @return {ImageData}
* @api public
*/
Context2d.prototype.getImageData = function(x, y, width, height){
var arr = new PixelArray(this.canvas, x, y, width, height);
return new ImageData(arr);
};
/**
* Create `ImageData` with the given dimensions or
* `ImageData` instance for dimensions.
*
* @param {Number|ImageData} width
* @param {Number} height
* @return {ImageData}
* @api public
*/
Context2d.prototype.createImageData = function(width, height){
if (width instanceof ImageData) {
height = width.height;
width = width.width;
}
return new ImageData(new PixelArray(width, height));
};
{ "name": "canvas"
, "description": "Canvas graphics API backed by Cairo"
, "version": "0.0.7"
, "version": "0.3.2"
, "author": "TJ Holowaychuk <tj@learnboost.com>"

@@ -5,0 +5,0 @@ , "keywords": ["canvas", "graphic", "graphics"]

@@ -61,2 +61,4 @@

Currently _only_ sync streaming is supported, however we plan on supporting async streaming as well (of course :) ). Until then the `Canvas#toBuffer(callback)` alternative is async utilizing `eio_custom()`.
### Canvas#toBuffer()

@@ -66,3 +68,2 @@

canvas.toBuffer();

@@ -69,0 +70,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

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