From edf1e69bf36360451acfc751ab9a5aba129c4931 Mon Sep 17 00:00:00 2001 From: lostjared Date: Sat, 24 Mar 2018 12:02:46 -0700 Subject: [PATCH] updated add Plugin callback --- src/ac.cpp | 24 ++++++++++++++++-------- src/ac.h | 2 ++ src/plugin.cpp | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/ac.cpp b/src/ac.cpp index ffe6130..a8c66fb 100644 --- a/src/ac.cpp +++ b/src/ac.cpp @@ -45,7 +45,7 @@ // Acid Cam namespace namespace ac { - const std::string version="2.3.4"; + const std::string version="2.3.5"; // variables unsigned int swapColor_r = 0, swapColor_g = 0, swapColor_b = 0; bool isNegative = false, noRecord = false, pass2_enabled = false, blendW = false, slide_Show = false, slide_Rand = false, strobe_It = false, switch_Back = false, blur_First = false; @@ -97,6 +97,7 @@ namespace ac { std::unordered_map filter_map; bool color_map_set = false; DrawFunction custom_callback = 0; + DrawFunction plugin_func = 0; } // globals @@ -4831,9 +4832,8 @@ void ac::ScanSwitch(cv::Mat &frame) { unsigned int h = frame.rows;// frame height static unsigned int start_index = 0; unsigned int index = start_index; - cv::Mat temp = frame.clone(); - for(unsigned int z = 1; z < h-1; ++z) { - for(unsigned int i = 1; i < w-1; ++i) { + for(unsigned int z = 3; z < h-3; ++z) { + for(unsigned int i = 3; i < w-3; ++i) { cv::Vec3b &pixel = frame.at(z, i); switch(index) { case 0: @@ -4864,9 +4864,8 @@ void ac::ScanAlphaSwitch(cv::Mat &frame) { static unsigned int start_index = 0; static double alpha = 1.0, alpha_max = 10.0; unsigned int index = start_index; - cv::Mat temp = frame.clone(); - for(unsigned int z = 1; z < h-1; ++z) { - for(unsigned int i = 1; i < w-1; ++i) { + for(unsigned int z = 3; z < h-3; ++z) { + for(unsigned int i = 3; i < w-3; ++i) { cv::Vec3b &pixel = frame.at(z, i); switch(index) { case 0: @@ -5423,5 +5422,14 @@ void ac::setCustom(DrawFunction f) { void ac::custom(cv::Mat &frame) { if(custom_callback != 0) custom_callback(frame); - +} + +void ac::setPlugin(DrawFunction f) { + plugin_func = f; +} + +void ac::plugin(cv::Mat &frame) { + if(plugin_func != 0) { + plugin_func(frame); + } } diff --git a/src/ac.h b/src/ac.h index df120d8..9fcce21 100644 --- a/src/ac.h +++ b/src/ac.h @@ -289,6 +289,7 @@ namespace ac { void plugin(cv::Mat &frame); // set Custom Filter callback function void setCustom(DrawFunction f); + void setPlugin(DrawFunction f); // color maps void ApplyColorMap(cv::Mat &frame); // color correction @@ -299,6 +300,7 @@ namespace ac { void filterFade(cv::Mat &frame, int filter1, int filter2, double alpha); // draw functions / strings extern std::string draw_strings[]; + extern DrawFunction plugin_func; extern DrawFunction draw_func[]; extern int draw_max; extern bool snapShot; diff --git a/src/plugin.cpp b/src/plugin.cpp index a277289..3496331 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -68,7 +68,7 @@ void draw_plugin(cv::Mat &frame, int filter) { } -void ac::plugin(cv::Mat &) { +void plugin_callback(cv::Mat &) { }