remove deprecation in imagetracer

This commit is contained in:
Mario Voigt 2021-11-24 00:38:19 +01:00
parent 8d8a9a14eb
commit eb4c4b4131
2 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,7 @@ var zlib = require('zlib');
var PNG = require('./PNG'); var PNG = require('./PNG');
var inflate = function(data, callback){ var inflate = function(data, callback){
return zlib.inflate(new Buffer(data), callback); return zlib.inflate(Buffer.from(data), callback);
}; };
var slice = Array.prototype.slice; var slice = Array.prototype.slice;
@ -180,7 +180,7 @@ PNGReader.prototype.decodePixels = function(callback){
var length = 0; var length = 0;
var i, j, k, l; var i, j, k, l;
for (l = this.dataChunks.length; l--;) length += this.dataChunks[l].length; for (l = this.dataChunks.length; l--;) length += this.dataChunks[l].length;
var data = new Buffer(length); var data = Buffer.alloc(length);
for (i = 0, k = 0, l = this.dataChunks.length; i < l; i++){ for (i = 0, k = 0, l = this.dataChunks.length; i < l; i++){
var chunk = this.dataChunks[i]; var chunk = this.dataChunks[i];
for (j = 0; j < chunk.length; j++) data[k++] = chunk[j]; for (j = 0; j < chunk.length; j++) data[k++] = chunk[j];
@ -214,7 +214,7 @@ PNGReader.prototype.interlaceNone = function(data){
// color bytes per row // color bytes per row
var cpr = bpp * png.width; var cpr = bpp * png.width;
var pixels = new Buffer(bpp * png.width * png.height); var pixels = Buffer.alloc(bpp * png.width * png.height);
var scanline; var scanline;
var offset = 0; var offset = 0;

View File

@ -105,7 +105,7 @@ class Imagetracerjs(inkex.EffectExtension):
nodeclipath = os.path.join("imagetracerjs-master", "nodecli", "nodecli.js") nodeclipath = os.path.join("imagetracerjs-master", "nodecli", "nodecli.js")
## Build up imagetracerjs command according to your settings from extension GUI ## Build up imagetracerjs command according to your settings from extension GUI
command = "node " # "node.exe" or "node" on Windows or just "node" on Linux command = "node --trace-deprecation " # "node.exe" or "node" on Windows or just "node" on Linux
if os.name=="nt": # your OS is Windows. We handle path separator as "\\" instead of unix-like "/" if os.name=="nt": # your OS is Windows. We handle path separator as "\\" instead of unix-like "/"
command += str(nodeclipath).replace("\\", "\\\\") command += str(nodeclipath).replace("\\", "\\\\")
else: else: