Native module migration wave 1, fixed issue with avatar
This commit is contained in:
parent
a097312620
commit
bdb15aee3f
28 changed files with 609 additions and 38 deletions
58
natives/9gag.cc
Normal file
58
natives/9gag.cc
Normal file
|
@ -0,0 +1,58 @@
|
|||
#include <napi.h>
|
||||
#include <list>
|
||||
#include <Magick++.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Magick;
|
||||
|
||||
class NineGagWorker : public Napi::AsyncWorker {
|
||||
public:
|
||||
NineGagWorker(Napi::Function& callback, string in_path, string type, int delay)
|
||||
: Napi::AsyncWorker(callback), in_path(in_path), type(type), delay(delay) {}
|
||||
~NineGagWorker() {}
|
||||
|
||||
void Execute() {
|
||||
list<Image> frames;
|
||||
list<Image> coalesced;
|
||||
list<Image> mid;
|
||||
list<Image> result;
|
||||
Image watermark;
|
||||
readImages(&frames, in_path);
|
||||
watermark.read("./assets/images/9gag.png");
|
||||
coalesceImages(&coalesced, frames.begin(), frames.end());
|
||||
|
||||
for (Image &image : coalesced) {
|
||||
image.composite(watermark, Magick::EastGravity, Magick::OverCompositeOp);
|
||||
image.magick(type);
|
||||
mid.push_back(image);
|
||||
}
|
||||
|
||||
optimizeImageLayers(&result, mid.begin(), mid.end());
|
||||
if (delay != 0) for_each(result.begin(), result.end(), animationDelayImage(delay));
|
||||
writeImages(result.begin(), result.end(), &blob);
|
||||
}
|
||||
|
||||
void OnOK() {
|
||||
Callback().Call({Env().Undefined(), Napi::Buffer<char>::Copy(Env(), (char *)blob.data(), blob.length())});
|
||||
}
|
||||
|
||||
private:
|
||||
string in_path, type;
|
||||
int delay, wordlength, i, n;
|
||||
size_t bytes, type_size;
|
||||
Blob blob;
|
||||
};
|
||||
|
||||
Napi::Value NineGag(const Napi::CallbackInfo &info)
|
||||
{
|
||||
Napi::Env env = info.Env();
|
||||
|
||||
string in_path = info[0].As<Napi::String>().Utf8Value();
|
||||
string type = info[1].As<Napi::String>().Utf8Value();
|
||||
int delay = info[2].As<Napi::Number>().Int32Value();
|
||||
Napi::Function cb = info[3].As<Napi::Function>();
|
||||
|
||||
NineGagWorker* ninegagWorker = new NineGagWorker(cb, in_path, type, delay);
|
||||
ninegagWorker->Queue();
|
||||
return env.Undefined();
|
||||
}
|
8
natives/9gag.h
Normal file
8
natives/9gag.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef ESMBOT_NATIVES_9GAG_H_
|
||||
#define ESMBOT_NATIVES_9GAG_H_
|
||||
|
||||
#include <napi.h>
|
||||
|
||||
Napi::Value NineGag(const Napi::CallbackInfo& info);
|
||||
|
||||
#endif
|
60
natives/bandicam.cc
Normal file
60
natives/bandicam.cc
Normal file
|
@ -0,0 +1,60 @@
|
|||
#include <napi.h>
|
||||
#include <list>
|
||||
#include <Magick++.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Magick;
|
||||
|
||||
class BandicamWorker : public Napi::AsyncWorker {
|
||||
public:
|
||||
BandicamWorker(Napi::Function& callback, string in_path, string type, int delay)
|
||||
: Napi::AsyncWorker(callback), in_path(in_path), type(type), delay(delay) {}
|
||||
~BandicamWorker() {}
|
||||
|
||||
void Execute() {
|
||||
list<Image> frames;
|
||||
list<Image> coalesced;
|
||||
list<Image> mid;
|
||||
list<Image> result;
|
||||
Image watermark;
|
||||
readImages(&frames, in_path);
|
||||
watermark.read("./assets/images/bandicam.png");
|
||||
string query("x" + to_string(frames.front().baseRows()));
|
||||
watermark.scale(Geometry(query));
|
||||
coalesceImages(&coalesced, frames.begin(), frames.end());
|
||||
|
||||
for (Image &image : coalesced) {
|
||||
image.composite(watermark, Magick::NorthGravity, Magick::OverCompositeOp);
|
||||
image.magick(type);
|
||||
mid.push_back(image);
|
||||
}
|
||||
|
||||
optimizeImageLayers(&result, mid.begin(), mid.end());
|
||||
if (delay != 0) for_each(result.begin(), result.end(), animationDelayImage(delay));
|
||||
writeImages(result.begin(), result.end(), &blob);
|
||||
}
|
||||
|
||||
void OnOK() {
|
||||
Callback().Call({Env().Undefined(), Napi::Buffer<char>::Copy(Env(), (char *)blob.data(), blob.length())});
|
||||
}
|
||||
|
||||
private:
|
||||
string in_path, type;
|
||||
int delay, wordlength, i, n;
|
||||
size_t bytes, type_size;
|
||||
Blob blob;
|
||||
};
|
||||
|
||||
Napi::Value Bandicam(const Napi::CallbackInfo &info)
|
||||
{
|
||||
Napi::Env env = info.Env();
|
||||
|
||||
string in_path = info[0].As<Napi::String>().Utf8Value();
|
||||
string type = info[1].As<Napi::String>().Utf8Value();
|
||||
int delay = info[2].As<Napi::Number>().Int32Value();
|
||||
Napi::Function cb = info[3].As<Napi::Function>();
|
||||
|
||||
BandicamWorker* bandicamWorker = new BandicamWorker(cb, in_path, type, delay);
|
||||
bandicamWorker->Queue();
|
||||
return env.Undefined();
|
||||
}
|
8
natives/bandicam.h
Normal file
8
natives/bandicam.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef ESMBOT_NATIVES_BANDICAM_H_
|
||||
#define ESMBOT_NATIVES_BANDICAM_H_
|
||||
|
||||
#include <napi.h>
|
||||
|
||||
Napi::Value Bandicam(const Napi::CallbackInfo& info);
|
||||
|
||||
#endif
|
56
natives/blur.cc
Normal file
56
natives/blur.cc
Normal file
|
@ -0,0 +1,56 @@
|
|||
#include <napi.h>
|
||||
#include <list>
|
||||
#include <Magick++.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Magick;
|
||||
|
||||
class BlurWorker : public Napi::AsyncWorker {
|
||||
public:
|
||||
BlurWorker(Napi::Function& callback, string in_path, string type, int delay)
|
||||
: Napi::AsyncWorker(callback), in_path(in_path), type(type), delay(delay) {}
|
||||
~BlurWorker() {}
|
||||
|
||||
void Execute() {
|
||||
list<Image> frames;
|
||||
list<Image> coalesced;
|
||||
list<Image> blurred;
|
||||
list<Image> result;
|
||||
readImages(&frames, in_path);
|
||||
coalesceImages(&coalesced, frames.begin(), frames.end());
|
||||
|
||||
for (Image &image : coalesced) {
|
||||
image.blur(15);
|
||||
image.magick(type);
|
||||
blurred.push_back(image);
|
||||
}
|
||||
|
||||
optimizeImageLayers(&result, blurred.begin(), blurred.end());
|
||||
if (delay != 0) for_each(result.begin(), result.end(), animationDelayImage(delay));
|
||||
writeImages(result.begin(), result.end(), &blob);
|
||||
}
|
||||
|
||||
void OnOK() {
|
||||
Callback().Call({Env().Undefined(), Napi::Buffer<char>::Copy(Env(), (char *)blob.data(), blob.length())});
|
||||
}
|
||||
|
||||
private:
|
||||
string in_path, type;
|
||||
int delay, wordlength, i, n;
|
||||
size_t bytes, type_size;
|
||||
Blob blob;
|
||||
};
|
||||
|
||||
Napi::Value Blur(const Napi::CallbackInfo &info)
|
||||
{
|
||||
Napi::Env env = info.Env();
|
||||
|
||||
string in_path = info[0].As<Napi::String>().Utf8Value();
|
||||
string type = info[1].As<Napi::String>().Utf8Value();
|
||||
int delay = info[2].As<Napi::Number>().Int32Value();
|
||||
Napi::Function cb = info[3].As<Napi::Function>();
|
||||
|
||||
BlurWorker* blurWorker = new BlurWorker(cb, in_path, type, delay);
|
||||
blurWorker->Queue();
|
||||
return env.Undefined();
|
||||
}
|
8
natives/blur.h
Normal file
8
natives/blur.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef ESMBOT_NATIVES_BLUR_H_
|
||||
#define ESMBOT_NATIVES_BLUR_H_
|
||||
|
||||
#include <napi.h>
|
||||
|
||||
Napi::Value Blur(const Napi::CallbackInfo& info);
|
||||
|
||||
#endif
|
57
natives/blurple.cc
Normal file
57
natives/blurple.cc
Normal file
|
@ -0,0 +1,57 @@
|
|||
#include <napi.h>
|
||||
#include <list>
|
||||
#include <Magick++.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Magick;
|
||||
|
||||
class BlurpleWorker : public Napi::AsyncWorker {
|
||||
public:
|
||||
BlurpleWorker(Napi::Function& callback, string in_path, string type, int delay)
|
||||
: Napi::AsyncWorker(callback), in_path(in_path), type(type), delay(delay) {}
|
||||
~BlurpleWorker() {}
|
||||
|
||||
void Execute() {
|
||||
list<Image> frames;
|
||||
list<Image> coalesced;
|
||||
list<Image> blurpled;
|
||||
list<Image> result;
|
||||
readImages(&frames, in_path);
|
||||
coalesceImages(&coalesced, frames.begin(), frames.end());
|
||||
|
||||
for (Image &image : coalesced) {
|
||||
image.threshold(49151.25);
|
||||
image.levelColors("#7289DA", "white");
|
||||
image.magick(type);
|
||||
blurpled.push_back(image);
|
||||
}
|
||||
|
||||
optimizeImageLayers(&result, blurpled.begin(), blurpled.end());
|
||||
if (delay != 0) for_each(result.begin(), result.end(), animationDelayImage(delay));
|
||||
writeImages(result.begin(), result.end(), &blob);
|
||||
}
|
||||
|
||||
void OnOK() {
|
||||
Callback().Call({Env().Undefined(), Napi::Buffer<char>::Copy(Env(), (char *)blob.data(), blob.length())});
|
||||
}
|
||||
|
||||
private:
|
||||
string in_path, type;
|
||||
int delay, wordlength, i, n;
|
||||
size_t bytes, type_size;
|
||||
Blob blob;
|
||||
};
|
||||
|
||||
Napi::Value Blurple(const Napi::CallbackInfo &info)
|
||||
{
|
||||
Napi::Env env = info.Env();
|
||||
|
||||
string in_path = info[0].As<Napi::String>().Utf8Value();
|
||||
string type = info[1].As<Napi::String>().Utf8Value();
|
||||
int delay = info[2].As<Napi::Number>().Int32Value();
|
||||
Napi::Function cb = info[3].As<Napi::Function>();
|
||||
|
||||
BlurpleWorker* blurpleWorker = new BlurpleWorker(cb, in_path, type, delay);
|
||||
blurpleWorker->Queue();
|
||||
return env.Undefined();
|
||||
}
|
8
natives/blurple.h
Normal file
8
natives/blurple.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef ESMBOT_NATIVES_BLURPLE_H_
|
||||
#define ESMBOT_NATIVES_BLURPLE_H_
|
||||
|
||||
#include <napi.h>
|
||||
|
||||
Napi::Value Blurple(const Napi::CallbackInfo& info);
|
||||
|
||||
#endif
|
56
natives/circle.cc
Normal file
56
natives/circle.cc
Normal file
|
@ -0,0 +1,56 @@
|
|||
#include <napi.h>
|
||||
#include <list>
|
||||
#include <Magick++.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Magick;
|
||||
|
||||
class CircleWorker : public Napi::AsyncWorker {
|
||||
public:
|
||||
CircleWorker(Napi::Function& callback, string in_path, string type, int delay)
|
||||
: Napi::AsyncWorker(callback), in_path(in_path), type(type), delay(delay) {}
|
||||
~CircleWorker() {}
|
||||
|
||||
void Execute() {
|
||||
list<Image> frames;
|
||||
list<Image> coalesced;
|
||||
list<Image> blurred;
|
||||
list<Image> result;
|
||||
readImages(&frames, in_path);
|
||||
coalesceImages(&coalesced, frames.begin(), frames.end());
|
||||
|
||||
for (Image &image : coalesced) {
|
||||
image.rotationalBlur(10);
|
||||
image.magick(type);
|
||||
blurred.push_back(image);
|
||||
}
|
||||
|
||||
optimizeImageLayers(&result, blurred.begin(), blurred.end());
|
||||
if (delay != 0) for_each(result.begin(), result.end(), animationDelayImage(delay));
|
||||
writeImages(result.begin(), result.end(), &blob);
|
||||
}
|
||||
|
||||
void OnOK() {
|
||||
Callback().Call({Env().Undefined(), Napi::Buffer<char>::Copy(Env(), (char *)blob.data(), blob.length())});
|
||||
}
|
||||
|
||||
private:
|
||||
string in_path, type;
|
||||
int delay, wordlength, i, n;
|
||||
size_t bytes, type_size;
|
||||
Blob blob;
|
||||
};
|
||||
|
||||
Napi::Value Circle(const Napi::CallbackInfo &info)
|
||||
{
|
||||
Napi::Env env = info.Env();
|
||||
|
||||
string in_path = info[0].As<Napi::String>().Utf8Value();
|
||||
string type = info[1].As<Napi::String>().Utf8Value();
|
||||
int delay = info[2].As<Napi::Number>().Int32Value();
|
||||
Napi::Function cb = info[3].As<Napi::Function>();
|
||||
|
||||
CircleWorker* circleWorker = new CircleWorker(cb, in_path, type, delay);
|
||||
circleWorker->Queue();
|
||||
return env.Undefined();
|
||||
}
|
8
natives/circle.h
Normal file
8
natives/circle.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef ESMBOT_NATIVES_CIRCLE_H_
|
||||
#define ESMBOT_NATIVES_CIRCLE_H_
|
||||
|
||||
#include <napi.h>
|
||||
|
||||
Napi::Value Circle(const Napi::CallbackInfo& info);
|
||||
|
||||
#endif
|
60
natives/deviantart.cc
Normal file
60
natives/deviantart.cc
Normal file
|
@ -0,0 +1,60 @@
|
|||
#include <napi.h>
|
||||
#include <list>
|
||||
#include <Magick++.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Magick;
|
||||
|
||||
class DeviantartWorker : public Napi::AsyncWorker {
|
||||
public:
|
||||
DeviantartWorker(Napi::Function& callback, string in_path, string type, int delay)
|
||||
: Napi::AsyncWorker(callback), in_path(in_path), type(type), delay(delay) {}
|
||||
~DeviantartWorker() {}
|
||||
|
||||
void Execute() {
|
||||
list<Image> frames;
|
||||
list<Image> coalesced;
|
||||
list<Image> mid;
|
||||
list<Image> result;
|
||||
Image watermark;
|
||||
readImages(&frames, in_path);
|
||||
watermark.read("./assets/images/deviantart.png");
|
||||
string query("x" + to_string(frames.front().baseRows()));
|
||||
watermark.scale(Geometry(query));
|
||||
coalesceImages(&coalesced, frames.begin(), frames.end());
|
||||
|
||||
for (Image &image : coalesced) {
|
||||
image.composite(watermark, Magick::CenterGravity, Magick::OverCompositeOp);
|
||||
image.magick(type);
|
||||
mid.push_back(image);
|
||||
}
|
||||
|
||||
optimizeImageLayers(&result, mid.begin(), mid.end());
|
||||
if (delay != 0) for_each(result.begin(), result.end(), animationDelayImage(delay));
|
||||
writeImages(result.begin(), result.end(), &blob);
|
||||
}
|
||||
|
||||
void OnOK() {
|
||||
Callback().Call({Env().Undefined(), Napi::Buffer<char>::Copy(Env(), (char *)blob.data(), blob.length())});
|
||||
}
|
||||
|
||||
private:
|
||||
string in_path, type;
|
||||
int delay, wordlength, i, n;
|
||||
size_t bytes, type_size;
|
||||
Blob blob;
|
||||
};
|
||||
|
||||
Napi::Value Deviantart(const Napi::CallbackInfo &info)
|
||||
{
|
||||
Napi::Env env = info.Env();
|
||||
|
||||
string in_path = info[0].As<Napi::String>().Utf8Value();
|
||||
string type = info[1].As<Napi::String>().Utf8Value();
|
||||
int delay = info[2].As<Napi::Number>().Int32Value();
|
||||
Napi::Function cb = info[3].As<Napi::Function>();
|
||||
|
||||
DeviantartWorker* deviantartWorker = new DeviantartWorker(cb, in_path, type, delay);
|
||||
deviantartWorker->Queue();
|
||||
return env.Undefined();
|
||||
}
|
8
natives/deviantart.h
Normal file
8
natives/deviantart.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef ESMBOT_NATIVES_DEVIANTART_H_
|
||||
#define ESMBOT_NATIVES_DEVIANTART_H_
|
||||
|
||||
#include <napi.h>
|
||||
|
||||
Napi::Value Deviantart(const Napi::CallbackInfo& info);
|
||||
|
||||
#endif
|
56
natives/explode.cc
Normal file
56
natives/explode.cc
Normal file
|
@ -0,0 +1,56 @@
|
|||
#include <napi.h>
|
||||
#include <list>
|
||||
#include <Magick++.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Magick;
|
||||
|
||||
class ExplodeWorker : public Napi::AsyncWorker {
|
||||
public:
|
||||
ExplodeWorker(Napi::Function& callback, string in_path, string type, int delay)
|
||||
: Napi::AsyncWorker(callback), in_path(in_path), type(type), delay(delay) {}
|
||||
~ExplodeWorker() {}
|
||||
|
||||
void Execute() {
|
||||
list<Image> frames;
|
||||
list<Image> coalesced;
|
||||
list<Image> blurred;
|
||||
list<Image> result;
|
||||
readImages(&frames, in_path);
|
||||
coalesceImages(&coalesced, frames.begin(), frames.end());
|
||||
|
||||
for (Image &image : coalesced) {
|
||||
image.implode(-1);
|
||||
image.magick(type);
|
||||
blurred.push_back(image);
|
||||
}
|
||||
|
||||
optimizeImageLayers(&result, blurred.begin(), blurred.end());
|
||||
if (delay != 0) for_each(result.begin(), result.end(), animationDelayImage(delay));
|
||||
writeImages(result.begin(), result.end(), &blob);
|
||||
}
|
||||
|
||||
void OnOK() {
|
||||
Callback().Call({Env().Undefined(), Napi::Buffer<char>::Copy(Env(), (char *)blob.data(), blob.length())});
|
||||
}
|
||||
|
||||
private:
|
||||
string in_path, type;
|
||||
int delay, wordlength, i, n;
|
||||
size_t bytes, type_size;
|
||||
Blob blob;
|
||||
};
|
||||
|
||||
Napi::Value Explode(const Napi::CallbackInfo &info)
|
||||
{
|
||||
Napi::Env env = info.Env();
|
||||
|
||||
string in_path = info[0].As<Napi::String>().Utf8Value();
|
||||
string type = info[1].As<Napi::String>().Utf8Value();
|
||||
int delay = info[2].As<Napi::Number>().Int32Value();
|
||||
Napi::Function cb = info[3].As<Napi::Function>();
|
||||
|
||||
ExplodeWorker* explodeWorker = new ExplodeWorker(cb, in_path, type, delay);
|
||||
explodeWorker->Queue();
|
||||
return env.Undefined();
|
||||
}
|
8
natives/explode.h
Normal file
8
natives/explode.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef ESMBOT_NATIVES_EXPLODE_H_
|
||||
#define ESMBOT_NATIVES_EXPLODE_H_
|
||||
|
||||
#include <napi.h>
|
||||
|
||||
Napi::Value Explode(const Napi::CallbackInfo& info);
|
||||
|
||||
#endif
|
28
natives/image.cc
Normal file
28
natives/image.cc
Normal file
|
@ -0,0 +1,28 @@
|
|||
#include <napi.h>
|
||||
#include "9gag.h"
|
||||
#include "bandicam.h"
|
||||
#include "blur.h"
|
||||
#include "blurple.h"
|
||||
//#include "caption.h"
|
||||
//#include "caption2.h"
|
||||
#include "circle.h"
|
||||
#include "deviantart.h"
|
||||
#include "explode.h"
|
||||
#include "invert.h"
|
||||
|
||||
Napi::Object Init(Napi::Env env, Napi::Object exports)
|
||||
{
|
||||
exports.Set(Napi::String::New(env, "nineGag"), Napi::Function::New(env, NineGag));
|
||||
exports.Set(Napi::String::New(env, "bandicam"), Napi::Function::New(env, Bandicam));
|
||||
exports.Set(Napi::String::New(env, "blur"), Napi::Function::New(env, Blur));
|
||||
exports.Set(Napi::String::New(env, "blurple"), Napi::Function::New(env, Blurple));
|
||||
//exports.Set(Napi::String::New(env, "caption"), Napi::Function::New(env, Caption));
|
||||
//exports.Set(Napi::String::New(env, "captionTwo"), Napi::Function::New(env, CaptionTwo));
|
||||
exports.Set(Napi::String::New(env, "circle"), Napi::Function::New(env, Circle));
|
||||
exports.Set(Napi::String::New(env, "deviantart"), Napi::Function::New(env, Deviantart));
|
||||
exports.Set(Napi::String::New(env, "explode"), Napi::Function::New(env, Explode));
|
||||
exports.Set(Napi::String::New(env, "invert"), Napi::Function::New(env, Invert));
|
||||
return exports;
|
||||
}
|
||||
|
||||
NODE_API_MODULE(addon, Init);
|
56
natives/invert.cc
Normal file
56
natives/invert.cc
Normal file
|
@ -0,0 +1,56 @@
|
|||
#include <napi.h>
|
||||
#include <list>
|
||||
#include <Magick++.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Magick;
|
||||
|
||||
class InvertWorker : public Napi::AsyncWorker {
|
||||
public:
|
||||
InvertWorker(Napi::Function& callback, string in_path, string type, int delay)
|
||||
: Napi::AsyncWorker(callback), in_path(in_path), type(type), delay(delay) {}
|
||||
~InvertWorker() {}
|
||||
|
||||
void Execute() {
|
||||
list<Image> frames;
|
||||
list<Image> coalesced;
|
||||
list<Image> inverted;
|
||||
list<Image> result;
|
||||
readImages(&frames, in_path);
|
||||
coalesceImages(&coalesced, frames.begin(), frames.end());
|
||||
|
||||
for (Image &image : coalesced) {
|
||||
image.negateChannel(Magick::ChannelType(Magick::CompositeChannels ^ Magick::AlphaChannel));
|
||||
image.magick(type);
|
||||
inverted.push_back(image);
|
||||
}
|
||||
|
||||
optimizeImageLayers(&result, inverted.begin(), inverted.end());
|
||||
if (delay != 0) for_each(result.begin(), result.end(), animationDelayImage(delay));
|
||||
writeImages(result.begin(), result.end(), &blob);
|
||||
}
|
||||
|
||||
void OnOK() {
|
||||
Callback().Call({Env().Undefined(), Napi::Buffer<char>::Copy(Env(), (char *)blob.data(), blob.length())});
|
||||
}
|
||||
|
||||
private:
|
||||
string in_path, type;
|
||||
int delay, wordlength, i, n;
|
||||
size_t bytes, type_size;
|
||||
Blob blob;
|
||||
};
|
||||
|
||||
Napi::Value Invert(const Napi::CallbackInfo &info)
|
||||
{
|
||||
Napi::Env env = info.Env();
|
||||
|
||||
string in_path = info[0].As<Napi::String>().Utf8Value();
|
||||
string type = info[1].As<Napi::String>().Utf8Value();
|
||||
int delay = info[2].As<Napi::Number>().Int32Value();
|
||||
Napi::Function cb = info[3].As<Napi::Function>();
|
||||
|
||||
InvertWorker* invertWorker = new InvertWorker(cb, in_path, type, delay);
|
||||
invertWorker->Queue();
|
||||
return env.Undefined();
|
||||
}
|
8
natives/invert.h
Normal file
8
natives/invert.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef ESMBOT_NATIVES_INVERT_H_
|
||||
#define ESMBOT_NATIVES_INVERT_H_
|
||||
|
||||
#include <napi.h>
|
||||
|
||||
Napi::Value Invert(const Napi::CallbackInfo& info);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue