From a1b12e16b4e5f96f1c4d8d8a897d22cc46eb34e6 Mon Sep 17 00:00:00 2001 From: Essem Date: Sun, 27 Feb 2022 22:28:01 -0600 Subject: [PATCH] Removed trump and leak Both commands have overstayed their welcome, could return through some other way however --- commands/image-editing/leak.js | 11 ----- commands/image-editing/trump.js | 10 ----- natives/image.cc | 4 -- natives/leak.cc | 68 ------------------------------ natives/leak.h | 5 --- natives/trump.cc | 74 --------------------------------- natives/trump.h | 5 --- 7 files changed, 177 deletions(-) delete mode 100644 commands/image-editing/leak.js delete mode 100644 commands/image-editing/trump.js delete mode 100644 natives/leak.cc delete mode 100644 natives/leak.h delete mode 100644 natives/trump.cc delete mode 100644 natives/trump.h diff --git a/commands/image-editing/leak.js b/commands/image-editing/leak.js deleted file mode 100644 index 48783f3..0000000 --- a/commands/image-editing/leak.js +++ /dev/null @@ -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; diff --git a/commands/image-editing/trump.js b/commands/image-editing/trump.js deleted file mode 100644 index ccca87c..0000000 --- a/commands/image-editing/trump.js +++ /dev/null @@ -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; diff --git a/natives/image.cc b/natives/image.cc index 97c0774..983dc42 100644 --- a/natives/image.cc +++ b/natives/image.cc @@ -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)); diff --git a/natives/leak.cc b/natives/leak.cc deleted file mode 100644 index f08c009..0000000 --- a/natives/leak.cc +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include - -#include -#include - -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::Buffer data = obj.Get("data").As>(); - string type = obj.Get("type").As().Utf8Value(); - int delay = - obj.Has("delay") ? obj.Get("delay").As().Int32Value() : 0; - - Blob blob; - - list frames; - list coalesced; - list 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::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"); - } -} \ No newline at end of file diff --git a/natives/leak.h b/natives/leak.h deleted file mode 100644 index 5280ada..0000000 --- a/natives/leak.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -Napi::Value Leak(const Napi::CallbackInfo& info); diff --git a/natives/trump.cc b/natives/trump.cc deleted file mode 100644 index 8ba517f..0000000 --- a/natives/trump.cc +++ /dev/null @@ -1,74 +0,0 @@ -#include -#include - -#include -#include - -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::Buffer data = obj.Get("data").As>(); - string type = obj.Get("type").As().Utf8Value(); - int delay = - obj.Has("delay") ? obj.Get("delay").As().Int32Value() : 0; - - Blob blob; - - list frames; - list coalesced; - list 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::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"); - } -} \ No newline at end of file diff --git a/natives/trump.h b/natives/trump.h deleted file mode 100644 index 032161b..0000000 --- a/natives/trump.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -Napi::Value Trump(const Napi::CallbackInfo& info);