From 5a96e08da047d60c875c70565aa8471ae819679f Mon Sep 17 00:00:00 2001 From: Gabriel Falcao Date: Sun, 27 Nov 2011 16:37:22 -0200 Subject: [PATCH 1/2] adding the keywords "image" and "images" to package.json in order to make this package easier to find --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 2435ace..e464fb3 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ , "description": "Canvas graphics API backed by Cairo" , "version": "0.8.1" , "author": "TJ Holowaychuk " - , "keywords": ["canvas", "graphic", "graphics", "pixman", "cairo"] + , "keywords": ["canvas", "graphic", "graphics", "pixman", "cairo", "image", "images"] + , "homepage": "https://github.com/learnboost/node-canvas" , "repository": "git://github.com/learnboost/node-canvas" , "scripts": { "preinstall": "node-waf configure build" From d2947dac67491dd23665fd768cf1e16aabcd227d Mon Sep 17 00:00:00 2001 From: Gabriel Falcao Date: Sun, 27 Nov 2011 17:39:21 -0200 Subject: [PATCH 2/2] fixing an example in readme.md --- Readme.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Readme.md b/Readme.md index ffa43fd..152cb90 100644 --- a/Readme.md +++ b/Readme.md @@ -45,8 +45,8 @@ console.log(''); node-canvas adds `Image#src=Buffer` support, allowing you to read images from disc, redis, etc and apply them via `ctx.drawImage()`. Below we draw scaled down squid png by reading it from the disk with node's I/O. -```javascript -fs.readFile(__dirname + '/images/squid.png', function(err){ +```javascript +fs.readFile(__dirname + '/images/squid.png', function(err, squid){ if (err) throw err; img = new Image; img.src = squid; @@ -54,7 +54,7 @@ fs.readFile(__dirname + '/images/squid.png', function(err){ }); ``` - Below is an example of a canvas drawing it-self as the source several time: + Below is an example of a canvas drawing it-self as the source several time: ```javascript var img = new Image; @@ -68,7 +68,7 @@ ctx.drawImage(img, 100, 0, 50, 50); To create a `PNGStream` simple call `canvas.createPNGStream()`, and the stream will start to emit _data_ events, finally emitting _end_ when finished. If an exception occurs the _error_ event is emitted. -```javascript +```javascript var fs = require('fs') , out = fs.createWriteStream(__dirname + '/text.png') , stream = canvas.createPNGStream(); @@ -105,7 +105,7 @@ canvas.toBuffer(function(err, buf){ ### Canvas#toDataURL() async Optionally we may pass a callback function to `Canvas#toDataURL()`, and this process will be performed asynchronously, and will `callback(err, str)`. - + ```javascript canvas.toDataURL(function(err, str){ @@ -145,7 +145,7 @@ In addition to those specified and commonly implemented by browsers, the followi ## Anti-Aliasing Set anti-aliasing mode - + - default - none - gray @@ -197,7 +197,7 @@ Tested with and designed for: 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 +## License (The MIT License) @@ -220,4 +220,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.