From 9dc3fc20b1f440534382b3670846037183fd30df Mon Sep 17 00:00:00 2001 From: brighthas Date: Mon, 21 Oct 2013 21:08:53 +0800 Subject: [PATCH] fixed fill --- lib/png.js | 4 +++- package.json | 40 +++++++++++++++++++++++++++------------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/lib/png.js b/lib/png.js index 5af85d5..c2c56c9 100755 --- a/lib/png.js +++ b/lib/png.js @@ -34,10 +34,12 @@ var PNG = exports.PNG = function(options) { this.width = options.width || 0; this.height = options.height || 0; - + this.data = this.width > 0 && this.height > 0 ? new Buffer(4 * this.width * this.height) : null; + if(options.fill && this.data){this.data.fill(0)}; + this.gamma = 0; this.readable = this.writable = true; diff --git a/package.json b/package.json index fe899b5..ce9cbbf 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,29 @@ { - "name": "pngjs", - "version": "0.4.0", - "description": "Simple PNG encoder/decoder", - "author": "Kuba Niegowski", - "contributors": [], - "homepage": "https://github.com/niegowski/node-pngjs/", - "keywords" : [ - "png" - ], - "engines": { - "node": "0.8.x" - }, - "main": "./lib/png.js" + "name": "node-png", + "version": "0.4.1", + "description": "Simple PNG encoder/decoder", + "author": "Kuba Niegowski", + "contributors": [], + "homepage": "https://github.com/niegowski/node-pngjs/", + "keywords": [ + "png" + ], + "engines": { + "node": "0.8.x" + }, + "main": "./lib/png.js", + "directories": { + "example": "examples" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git://github.com/brighthas/node-pngjs.git" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/brighthas/node-pngjs/issues" + } }