Removed trump and leak

Both commands have overstayed their welcome, could return through some other way however
This commit is contained in:
Essem 2022-02-27 22:28:01 -06:00
parent 4a3d880a61
commit a1b12e16b4
No known key found for this signature in database
GPG Key ID: 7D497397CC3A2A8C
7 changed files with 0 additions and 177 deletions

View File

@ -1,11 +0,0 @@
import ImageCommand from "../../classes/imageCommand.js";
class LeakCommand extends ImageCommand {
static description = "Creates a fake Smash leak thumbnail";
static aliases = ["smash", "laxchris", "ssbu", "smashleak"];
static noImage = "You need to provide an image/GIF to make a Smash leak thumbnail!";
static command = "leak";
}
export default LeakCommand;

View File

@ -1,10 +0,0 @@
import ImageCommand from "../../classes/imageCommand.js";
class TrumpCommand extends ImageCommand {
static description = "Makes Trump display an image";
static noImage = "You need to provide an image/GIF for Trump to display!";
static command = "trump";
}
export default TrumpCommand;

View File

@ -16,7 +16,6 @@
#include "homebrew.h"
#include "invert.h"
#include "jpeg.h"
#include "leak.h"
#include "magik.h"
#include "meme.h"
#include "mirror.h"
@ -32,7 +31,6 @@
#include "sonic.h"
#include "spin.h"
#include "tile.h"
#include "trump.h"
#include "uncaption.h"
#include "wall.h"
#include "watermark.h"
@ -68,7 +66,6 @@ Napi::Object Init(Napi::Env env, Napi::Object exports)
exports.Set(Napi::String::New(env, "homebrew"), Napi::Function::New(env, Homebrew));
exports.Set(Napi::String::New(env, "invert"), Napi::Function::New(env, Invert));
exports.Set(Napi::String::New(env, "jpeg"), Napi::Function::New(env, Jpeg));
exports.Set(Napi::String::New(env, "leak"), Napi::Function::New(env, Leak));
exports.Set(Napi::String::New(env, "magik"), Napi::Function::New(env, Magik));
exports.Set(Napi::String::New(env, "meme"), Napi::Function::New(env, Meme));
exports.Set(Napi::String::New(env, "mirror"), Napi::Function::New(env, Mirror));
@ -84,7 +81,6 @@ Napi::Object Init(Napi::Env env, Napi::Object exports)
exports.Set(Napi::String::New(env, "spin"), Napi::Function::New(env, Spin));
exports.Set(Napi::String::New(env, "swirl"), Napi::Function::New(env, Swirl));
exports.Set(Napi::String::New(env, "tile"), Napi::Function::New(env, Tile));
exports.Set(Napi::String::New(env, "trump"), Napi::Function::New(env, Trump));
exports.Set(Napi::String::New(env, "uncaption"), Napi::Function::New(env, Uncaption));
exports.Set(Napi::String::New(env, "wall"), Napi::Function::New(env, Wall));
exports.Set(Napi::String::New(env, "watermark"), Napi::Function::New(env, Watermark));

View File

@ -1,68 +0,0 @@
#include <Magick++.h>
#include <napi.h>
#include <iostream>
#include <list>
using namespace std;
using namespace Magick;
Napi::Value Leak(const Napi::CallbackInfo &info) {
Napi::Env env = info.Env();
try {
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Buffer<char> data = obj.Get("data").As<Napi::Buffer<char>>();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay =
obj.Has("delay") ? obj.Get("delay").As<Napi::Number>().Int32Value() : 0;
Blob blob;
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
Image watermark;
try {
readImages(&frames, Blob(data.Data(), data.Length()));
} catch (Magick::WarningCoder &warning) {
cerr << "Coder Warning: " << warning.what() << endl;
} catch (Magick::Warning &warning) {
cerr << "Warning: " << warning.what() << endl;
}
watermark.read("./assets/images/leak.png");
coalesceImages(&coalesced, frames.begin(), frames.end());
for (Image &image : coalesced) {
image.backgroundColor("white");
image.scale(Geometry("640x360!"));
image.rotate(15);
image.extent(Geometry("1280x720-700+100"));
image.composite(watermark, Geometry("+0+0"), Magick::OverCompositeOp);
image.magick(type);
mid.push_back(image);
}
optimizeTransparency(mid.begin(), mid.end());
if (type == "gif") {
for (Image &image : mid) {
image.quantizeDither(false);
image.quantize();
if (delay != 0) image.animationDelay(delay);
}
}
writeImages(mid.begin(), mid.end(), &blob);
Napi::Object result = Napi::Object::New(env);
result.Set("data", Napi::Buffer<char>::Copy(env, (char *)blob.data(),
blob.length()));
result.Set("type", type);
return result;
} catch (std::exception const &err) {
throw Napi::Error::New(env, err.what());
} catch (...) {
throw Napi::Error::New(env, "Unknown error");
}
}

View File

@ -1,5 +0,0 @@
#pragma once
#include <napi.h>
Napi::Value Leak(const Napi::CallbackInfo& info);

View File

@ -1,74 +0,0 @@
#include <Magick++.h>
#include <napi.h>
#include <iostream>
#include <list>
using namespace std;
using namespace Magick;
Napi::Value Trump(const Napi::CallbackInfo &info) {
Napi::Env env = info.Env();
try {
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Buffer<char> data = obj.Get("data").As<Napi::Buffer<char>>();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay =
obj.Has("delay") ? obj.Get("delay").As<Napi::Number>().Int32Value() : 0;
Blob blob;
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
Image watermark;
try {
readImages(&frames, Blob(data.Data(), data.Length()));
} catch (Magick::WarningCoder &warning) {
cerr << "Coder Warning: " << warning.what() << endl;
} catch (Magick::Warning &warning) {
cerr << "Warning: " << warning.what() << endl;
}
watermark.read("./assets/images/trump.png");
coalesceImages(&coalesced, frames.begin(), frames.end());
for (Image &image : coalesced) {
Image watermark_new = watermark;
image.virtualPixelMethod(Magick::TransparentVirtualPixelMethod);
image.backgroundColor("none");
image.scale(Geometry("365x179!"));
double arguments[16] = {0, 0, 207, 268, 365, 0, 548, 271,
365, 179, 558, 450, 0, 179, 193, 450};
image.distort(Magick::PerspectiveDistortion, 16, arguments, true);
image.extent(Geometry("800x450"), Magick::CenterGravity);
watermark_new.composite(image, Geometry("-25+134"),
Magick::DstOverCompositeOp);
watermark_new.magick(type);
watermark_new.animationDelay(delay == 0 ? image.animationDelay() : delay);
watermark_new.gifDisposeMethod(Magick::BackgroundDispose);
mid.push_back(watermark_new);
}
optimizeTransparency(mid.begin(), mid.end());
if (type == "gif") {
for (Image &image : mid) {
image.quantizeDitherMethod(FloydSteinbergDitherMethod);
image.quantize();
}
}
writeImages(mid.begin(), mid.end(), &blob);
Napi::Object result = Napi::Object::New(env);
result.Set("data", Napi::Buffer<char>::Copy(env, (char *)blob.data(),
blob.length()));
result.Set("type", type);
return result;
} catch (std::exception const &err) {
throw Napi::Error::New(env, err.what());
} catch (...) {
throw Napi::Error::New(env, "Unknown error");
}
}

View File

@ -1,5 +0,0 @@
#pragma once
#include <napi.h>
Napi::Value Trump(const Napi::CallbackInfo& info);