diff options
| author | Jules Laplace <jules@okfoc.us> | 2016-06-09 16:16:31 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2016-06-09 16:16:31 -0400 |
| commit | a4c301d2c58e6c56b98766edbfee0d40d49add42 (patch) | |
| tree | 88b8d952192f0328e9014e87f918a6c1771b2ac3 /js/ui | |
| parent | 448e55b683d9eeda3fd0f6c96287a4f3b70bc9a1 (diff) | |
colorize tool
Diffstat (limited to 'js/ui')
| -rw-r--r-- | js/ui/nopaint.js | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/js/ui/nopaint.js b/js/ui/nopaint.js index c76d269..74ddadf 100644 --- a/js/ui/nopaint.js +++ b/js/ui/nopaint.js @@ -486,7 +486,6 @@ var nopaint = (function(){ var shape = choice(this.shapes) this.reorient( last_brush ) brush.char = " " - console.log(shape[0].length, shape.length) brush.resize(shape[0].length, shape.length) brush.generate() brush.rebuild() @@ -671,8 +670,6 @@ var nopaint = (function(){ var ShaderTool = NopaintTool.extend({ type: "shader", - dx: 0, - dy: 0, speed: 3, is_shader: true, is_recursive: false, @@ -706,6 +703,24 @@ var nopaint = (function(){ } }) + var ColorizeTool = ShaderTool.extend({ + type: "colorize", + fns: [mirc_color_reverse,hue,inv_hue,gray,fire,red,yellow,green,blue,purple,dark_gray], + speed: 5, + start: function(){ + this.__start() + this.i = randint(this.fns.length) + }, + before_shade: function(){ + this.i = (this.i + 1) % this.fns.length + this.fn = this.fns[this.i] + }, + shade: function(src, dest, lex, x, y, w, h){ + lex.bg = this.fn( lex.bg ) + return false + }, + }) + var TranslateTool = ShaderTool.extend({ type: "translate", dx: 0, @@ -833,6 +848,7 @@ var nopaint = (function(){ nopaint.add_tool( new CycleTool({ weight: 1 }) ) nopaint.add_tool( new ScaleTool({ weight: 3 }) ) nopaint.add_tool( new RotateTool({ weight: 3 }) ) + nopaint.add_tool( new ColorizeTool({ weight: 1 }) ) nopaint.regenerate_weights() nopaint.toggle(true) |
