mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-11 19:00:00 +01:00
* 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>
71 lines
1.9 KiB
JavaScript
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
|
|
}
|
|
}
|