Permalink
Browse files

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

  • Loading branch information...
1 parent 69b9144 commit 64c491a2b7be29c0547f26d3506c77abc3357cf1 @aheckmann aheckmann committed Sep 6, 2010
Showing with 17 additions and 18 deletions.
  1. +17 −5 index.js
  2. +0 −13 lib/static.js
View
@@ -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)
View
@@ -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
-}

0 comments on commit 64c491a

Please sign in to comment.