Fix overlay (#1082)

* fix Overlay

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

* update canvas background color

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
This commit is contained in:
Varun Gupta
2019-05-27 23:23:55 +05:30
committed by Jeffrey Warren
parent ca73a4115e
commit 641ffd7a1a
2 changed files with 11 additions and 11 deletions

View File

@@ -21,7 +21,7 @@ module.exports = function canvasResize(options, UI) {
var step = this;
function extraManipulation(pixels) {
let newPixels = require('ndarray')(new Uint8Array(4 * options.width * options.height).fill(255), [options.width, options.height, 4]);
let newPixels = require('ndarray')(new Uint8Array(4 * options.width * options.height).fill(0), [options.width, options.height, 4]);
let iMax = options.width - options.x,
jMax = options.height - options.y;
for (let i = 0; i < iMax && i < pixels.shape[0]; i++) {

View File

@@ -9,7 +9,7 @@ module.exports = function Dynamic(options, UI, util) {
// This function is called on every draw.
function draw(input, callback, progressObj) {
options.offset = options.offset || -2;
options.offset = parseInt(options.offset) || -2;
progressObj.stop(true);
progressObj.overrideFlag = true;
@@ -42,14 +42,14 @@ module.exports = function Dynamic(options, UI, util) {
// overlay
var p = options.secondImagePixels;
if (x >= options.x
&& x < p.shape[0]
&& x - options.x < p.shape[0]
&& y >= options.y
&& y < p.shape[1])
&& y - options.y < p.shape[1])
return [
p.get(x, y, 0),
p.get(x, y, 1),
p.get(x, y, 2),
p.get(x, y, 3)
p.get(x - options.x, y - options.y, 0),
p.get(x - options.x, y - options.y, 1),
p.get(x - options.x, y - options.y, 2),
p.get(x - options.x, y - options.y, 3)
];
else
return [r1, g1, b1, a1];