mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-17 13:50:04 +01:00
add API to get steps (#259)
* add API to get steps Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * update dist and refactor Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * rename to getStepOutput Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * api complete Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * add test Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * change indentation to 2 spaces Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * minor fixes Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * new API Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * remove commented code Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * modifiication to invert Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
This commit is contained in:
committed by
Jeffrey Warren
parent
bd490d2515
commit
09c4f250a2
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Invert the image
|
||||
*/
|
||||
module.exports = function Invert(options,UI) {
|
||||
module.exports = function Invert(options, UI) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
@@ -10,8 +10,11 @@ module.exports = function Invert(options,UI) {
|
||||
var output;
|
||||
|
||||
// The function which is called on every draw.
|
||||
function draw(input,callback,progressObj) {
|
||||
function draw(input, callback, progressObj) {
|
||||
|
||||
console.log(getStep(-2).options.name);
|
||||
console.log(getStep(-1).options.name);
|
||||
console.log(getStep(0).options.name);
|
||||
progressObj.stop(true);
|
||||
progressObj.overrideFlag = true;
|
||||
// Tell UI that a step is being drawn.
|
||||
@@ -20,13 +23,13 @@ module.exports = function Invert(options,UI) {
|
||||
var step = this;
|
||||
|
||||
function changePixel(r, g, b, a) {
|
||||
return [255-r, 255-g, 255-b, a];
|
||||
return [255 - r, 255 - g, 255 - b, a];
|
||||
}
|
||||
|
||||
function output(image,datauri,mimetype){
|
||||
function output(image, datauri, mimetype) {
|
||||
|
||||
// This output is accessible by Image Sequencer
|
||||
step.output = {src:datauri,format:mimetype};
|
||||
step.output = { src: datauri, format: mimetype };
|
||||
|
||||
// This output is accessible by UI
|
||||
options.step.output = datauri;
|
||||
@@ -48,7 +51,7 @@ module.exports = function Invert(options,UI) {
|
||||
|
||||
return {
|
||||
options: options,
|
||||
draw: draw,
|
||||
draw: draw,
|
||||
output: output,
|
||||
UI: UI
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user