Files
image-sequencer/src/modules/FisheyeGl/Module.js
Varun Gupta 8d6b82d988 Minimize mod req (#289)
* remove trailing spaces from Run.js

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* minimize module requirements demonstrated with invert fixes #122

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* refactored modules

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* update docs

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* remove all trailing spaces from all files

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* fixing crop module

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* fix

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* update contributing.md

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
2018-06-15 14:44:18 -05:00

71 lines
1.9 KiB
JavaScript

/*
* Resolves Fisheye Effect
*/
module.exports = function DoNothing(options,UI) {
var output;
require('fisheyegl');
function draw(input,callback) {
var step = this;
if (!options.inBrowser) { // This module is only for browser
this.output = input;
callback();
}
else {
// Create a canvas, if it doesn't already exist.
if (!document.querySelector('#image-sequencer-canvas')) {
var canvas = document.createElement('canvas');
canvas.style.display = "none";
canvas.setAttribute('id','image-sequencer-canvas');
document.body.append(canvas);
}
else var canvas = document.querySelector('#image-sequencer-canvas');
distorter = FisheyeGl({
selector: "#image-sequencer-canvas"
});
// Parse the inputs
options.a = parseFloat(options.a) || distorter.lens.a;
options.b = parseFloat(options.b) || distorter.lens.b;
options.Fx = parseFloat(options.Fx) || distorter.lens.Fx;
options.Fy = parseFloat(options.Fy) || distorter.lens.Fy;
options.scale = parseFloat(options.scale) || distorter.lens.scale;
options.x = parseFloat(options.x) || distorter.fov.x;
options.y = parseFloat(options.y) || distorter.fov.y;
// Set fisheyegl inputs
distorter.lens.a = options.a;
distorter.lens.b = options.b;
distorter.lens.Fx = options.Fx;
distorter.lens.Fy = options.Fy;
distorter.lens.scale = options.scale;
distorter.fov.x = options.x;
distorter.fov.y = options.y;
// generate fisheyegl output
distorter.setImage(input.src,function(){
// this output is accessible to Image Sequencer
step.output = {src: canvas.toDataURL(), format: input.format};
// Tell Image Sequencer and UI that step has been drawn
callback();
});
}
}
return {
options: options,
draw: draw,
output: output,
UI: UI
}
}