can now manipulate as well as create images using gm() constructor

master
Aaron Heckmann 14 years ago
parent 69b91448f9
commit 64c491a2b7
  1. 22
      index.js
  2. 13
      lib/static.js

@ -3,17 +3,29 @@
module.exports = gm
function gm(source){
function gm(source, height, color){
if (!(this instanceof gm))
return new gm(source)
this.source = source || ""
return new gm(source, height, color)
this.data = {}
this._in = []
this._out = []
var width
if (height){
// new images
width = source
source = ""
this.arg(
[ "-size", width + "x" + height ]
.concat( color ? ['"xc:'+ color + '"'] : [] )
)
}
this.source = source
}
require("./lib/static")
require("./lib/getters")(gm.prototype)
require("./lib/args")(gm.prototype)
require("./lib/drawing")(gm.prototype)

@ -1,13 +0,0 @@
// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
var gm = module.parent.exports
gm.new = function(width, height, color){
var ret = gm().arg(
[ "-size", width + "x" + height ]
.concat( color ? ['"xc:'+ color + '"'] : [] )
)
ret._isnew = true
return ret
}
Loading…
Cancel
Save