diff --git a/index.html b/index.html index f412acd..16327b9 100644 --- a/index.html +++ b/index.html @@ -23,6 +23,7 @@ + diff --git a/scripts/command.js b/scripts/command.js index 010a2ce..c703cdf 100644 --- a/scripts/command.js +++ b/scripts/command.js @@ -6,6 +6,7 @@ function Command(content) function raster(array) // @ {50w}x100 { + return array; var str = array.join(" "); var m = str.replace(/(\{(.*)\})/g, function(a) { diff --git a/scripts/modules/filter.eval.js b/scripts/modules/filter.eval.js new file mode 100644 index 0000000..695e29a --- /dev/null +++ b/scripts/modules/filter.eval.js @@ -0,0 +1,27 @@ +Filter.prototype.filter_eval = function(pixels = this.pixels(),p = null) +{ + console.log("working"); + + // : eval {x} % 100 == 0 + + var data = pixels.data; + + for (var i = 0; i < data.length; i += 4) { + + var x = (i/4) % pixels.width; + var y = Math.floor((i/4)/pixels.width); + + var q = (x % parseInt(p[0]) === 0 && y % parseInt(p[1]) === 0); + + if(q === true){ + data[i] = 255; // red + data[i + 1] = 0; // green + data[i + 2] = 0; // blue + data[i + 3] = 255; // alpha? + } + } + + ronin.canvas.clear(); + ronin.canvas.context().putImageData(pixels, 0, 0, 0, 0, pixels.width, pixels.height); + console.log("done."); +} \ No newline at end of file diff --git a/scripts/modules/filter.js b/scripts/modules/filter.js index dd6fcd6..9625f74 100644 --- a/scripts/modules/filter.js +++ b/scripts/modules/filter.js @@ -19,6 +19,9 @@ function Filter(element) case "chromatic": this.filter_chromatic(this.pixels(),p); break; + case "eval": + this.filter_eval(this.pixels(),p); + break; } }