Socket
Socket
Sign inDemoInstall

term-canvas

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

term-canvas - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

examples/animated-chart.js

6

examples/lines.js

@@ -24,3 +24,5 @@

var canvas = new Canvas(size[1], size[0])
, ctx = canvas.getContext('2d');
, ctx = canvas.getContext('2d')
, x = 15
, y = 10;

@@ -33,3 +35,3 @@ ctx.hideCursor();

ctx.lineTo(5, 5);
ctx.lineTo(15, 10);
ctx.lineTo(x += .2, y += .1);
ctx.lineTo(40, 5);

@@ -36,0 +38,0 @@ ctx.lineTo(5, 5);

@@ -11,2 +11,4 @@

ctx.clear();
ctx.fillStyle = 'red';

@@ -13,0 +15,0 @@ ctx.fillRect(5, 5, 20, 10);

@@ -11,2 +11,4 @@

ctx.clear();
ctx.fillStyle = 'red';

@@ -13,0 +15,0 @@ ctx.fillRect(5, 5, 20, 10);

0.0.4 / 2011-12-05
==================
* Added animated chart example
* Added grid example
* Added `Context2d#translate(x,y)`
* Added `Context2d#scale(x, y)`
0.0.3 / 2011-11-20

@@ -3,0 +11,0 @@ ==================

@@ -164,2 +164,36 @@

/**
* Scale (`x`, `y`) or (`x`, `x`).
*
* @param {Number} x
* @param {Number} y
* @return {Context2d}
* @api public
*/
Context2d.prototype.scale = function(x, y){
if (2 == arguments.length) {
this.state().scaleX = Math.max(x, 0);
this.state().scaleY = Math.max(y, 0);
return this;
} else {
return this.scale(x, x);
}
};
/**
* Translate (`x`, `y`).
*
* @param {Number} x
* @param {Number} y
* @return {Context2d}
* @api public
*/
Context2d.prototype.translate = function(x, y){
this.state().translateX = Math.max(x, 0);
this.state().translateY = Math.max(y, 0);
return this;
};
/**
* Plot line with the given points using

@@ -326,2 +360,5 @@ * Bresenham's line algo.

Context2d.prototype.fillText = function(str, x, y){
var state = this.state();
x += state.translateX;
y += state.translateY;
this.applyForegroundFillStyle();

@@ -371,3 +408,9 @@ this.moveTo(x, y);

Context2d.prototype.strokeRect = function(x, y, w, h){
var hr = Array(w + 1).join(' ');
var state = this.state();
w *= state.scaleX;
h *= state.scaleY;
x += state.translateX;
y += state.translateY;
var hr = Array(Math.round(w + 1)).join(' ');
this.applyStrokeStyle();

@@ -397,2 +440,8 @@ this.moveTo(x, y);

Context2d.prototype.fillRect = function(ox, oy, w, h){
var state = this.state();
w *= state.scaleX;
h *= state.scaleY;
ox += state.translateX;
oy += state.translateY;
this.applyFillStyle();

@@ -399,0 +448,0 @@ for (var y = 0; y < h; ++y) {

@@ -15,2 +15,6 @@

this.stroke = 'normal';
this.scaleX = 1;
this.scaleY = 1;
this.translateX = 0;
this.translateY = 0;
}

@@ -24,2 +24,2 @@

exports.version = '0.0.1';
exports.version = '0.0.4';
{
"name": "term-canvas"
, "version": "0.0.3"
, "version": "0.0.4"
, "description": "Terminal canvas api written with node.js"

@@ -5,0 +5,0 @@ , "keywords": ["canvas", "ascii", "ansi", "terminal", "shell"]

@@ -6,2 +6,6 @@

![terminal canvas chart](http://f.cl.ly/items/0s112y02180S0l0N0u12/Grab.png)
![terminal canvas grid](http://f.cl.ly/items/3t3616131p0N032p1906/Screenshot.png)
## Installation

@@ -131,2 +135,6 @@

## Tests
There are none! currently testing with OSX "Terminal".
## License

@@ -133,0 +141,0 @@

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