got plugins working on Linux

This commit is contained in:
lostjared
2017-02-14 00:27:14 -08:00
parent b5b06390e2
commit 43d875c0e7
3 changed files with 31 additions and 8 deletions

View File

@@ -26,6 +26,12 @@ void generate_map() {
filter_map[filter_n] = std::make_pair(1, index);
++index;
}
for(unsigned int j = 0; j < plugins.plugin_list.size(); ++j) {
std::string name = "plugin " + plugins.plugin_list[j]->name();
filter_map[name] = std::make_pair(2, j);
}
}
void custom_filter(cv::Mat &) {
@@ -90,15 +96,16 @@ void Playback::run() {
if(current.size()>0) {
ac::in_custom = true;
for(unsigned int i = 0; i < current.size(); ++i) {
if(i == current.size()-1)
ac::in_custom = false;
if(current[i].first == 0) {
ac::draw_func[current[i].second](frame);
} else {
} else if(current[i].first == 1) {
current_filterx = current[i].second;
ac::alphaFlame(frame);
} else if(current[i].first == 2) {
draw_plugin(frame, current[i].second);
}
}
}
@@ -205,8 +212,8 @@ AC_MainWindow::~AC_MainWindow() {
delete playback;
}
AC_MainWindow::AC_MainWindow(QWidget *parent) : QMainWindow(parent) {
generate_map();
init_plugins();
generate_map();
setGeometry(100, 100, 800, 600);
setFixedSize(800, 600);
setWindowTitle(tr("Acid Cam v2 - Qt"));
@@ -253,6 +260,11 @@ void AC_MainWindow::createControls() {
filters->addItem(filter_n.c_str());
}
for(unsigned int i = 0; i < plugins.plugin_list.size(); ++i) {
std::string name = "plugin " + plugins.plugin_list[i]->name();
filters->addItem(name.c_str());
}
btn_add = new QPushButton(tr("Add"), this);
btn_remove = new QPushButton(tr("Remove"), this);
btn_moveup = new QPushButton(tr("Move Up"), this);

View File

@@ -6,6 +6,12 @@ void add_directory(QDir &cdir, std::vector<std::string> &files) {
cdir.setFilter(QDir::Files | QDir::Dirs);
QFileInfoList list = cdir.entryInfoList();
int pos = 0;
QString platform;
#if defined(__linux__) || defined(__APPLE__)
platform = ".so";
#else
platform = ".dll";
#endif
while(pos < list.size()) {
QFileInfo info = list.at(pos);
if(info.isDir() && info.fileName() != "." && info.fileName() != "..") {
@@ -15,7 +21,7 @@ void add_directory(QDir &cdir, std::vector<std::string> &files) {
++pos;
continue;
}
else if(info.isFile() && info.fileName() != "." && info.fileName() != ".." && info.fileName().contains(".so")) {
else if(info.isFile() && info.fileName() != "." && info.fileName() != ".." && info.fileName().contains(platform)) {
files.push_back(info.filePath().toStdString());
}
++pos;
@@ -35,8 +41,7 @@ void init_plugins() {
}
}
void ac::plugin(cv::Mat &frame) {
void draw_plugin(cv::Mat &frame, int filter) {
for(int z = 0; z < frame.rows; ++z) {
for(int i = 0; i < frame.cols; ++i) {
unsigned char rgb[3];
@@ -44,13 +49,18 @@ void ac::plugin(cv::Mat &frame) {
rgb[0] = cpixel[0];
rgb[1] = cpixel[1];
rgb[2] = cpixel[2];
//plugins.plugin_list[0]->call_Pixel(i, z, rgb);
plugins.plugin_list[filter]->call_Pixel(i, z, rgb);
cpixel[0] = rgb[0];
cpixel[1] = rgb[1];
cpixel[2] = rgb[2];
}
}
//plugins.plugin_list[0]->call_Complete();
plugins.plugin_list[filter]->call_Complete();
}
void ac::plugin(cv::Mat &frame) {
}
Plugin::Plugin() {

View File

@@ -34,5 +34,6 @@
#include<utility>
void init_plugins();
void draw_plugin(cv::Mat &frame, int filter);
#endif