19 lines
413 B
TypeScript
19 lines
413 B
TypeScript
|
/// <reference path="Algorithm.ts" />
|
||
|
|
||
|
/**
|
||
|
* Demo algorithm that fills image with noise
|
||
|
*/
|
||
|
class Noise extends Algorithm {
|
||
|
/**
|
||
|
* Run the algorithm
|
||
|
*/
|
||
|
run() {
|
||
|
var width = this.output.getWidth();
|
||
|
var height = this.output.getHeight();
|
||
|
var pixels = this.output.getPixels8();
|
||
|
var end = width * height * 3;
|
||
|
for (var i = 0; i < end; ++i) {
|
||
|
pixels[i] = Math.random()*255;
|
||
|
}
|
||
|
}
|
||
|
}
|