:(
---------- Forwarded message ---------- From: *Андрей Рандрианасулу* <rand...@mail.ru> Date: Sunday, May 8, 2022 Subject: failed experiment at making burn configurable To: randrianasulu <randrianas...@gmail.com> fail at attempt at using sliders -- Андрей Рандрианасулу
diff --git a/cinelerra-5.1/plugins/burn/burn.C b/cinelerra-5.1/plugins/burn/burn.C index cbf9939e..b139dc5b 100644 --- a/cinelerra-5.1/plugins/burn/burn.C +++ b/cinelerra-5.1/plugins/burn/burn.C @@ -38,22 +38,22 @@ REGISTER_PLUGIN(BurnMain) - - - - - - - - - -BurnConfig::BurnConfig() +void BurnConfig::reset() { threshold = 50; decay = 15; recycle = 1.0; } +BurnConfig::BurnConfig() +{ + reset(); +} + +BurnConfig::~BurnConfig() +{ +} + BurnMain::BurnMain(PluginServer *server) : PluginVClient(server) { @@ -64,6 +64,27 @@ BurnMain::BurnMain(PluginServer *server) effecttv = 0; } +int BurnConfig::equivalent(BurnConfig &that) +{ + return threshold == that.threshold && + decay == that.decay; +} + +void BurnConfig::copy_from(BurnConfig &that) +{ + threshold = that.threshold; + decay = that.decay; +} + +void BurnConfig::interpolate(BurnConfig &prev, + BurnConfig &next, int64_t prev_frame, int64_t next_frame, int64_t current_frame) + +{ + copy_from(prev); +} + + + BurnMain::~BurnMain() { @@ -80,23 +101,58 @@ int BurnMain::is_realtime() { return 1; } NEW_WINDOW_MACRO(BurnMain, BurnWindow) -int BurnMain::load_configuration() +/*int BurnMain::load_configuration() { - return 0; -//printf("BurnMain::load_configuration %d\n", source_position); + //defaults = load_defaults_xml(); + + config.threshold = defaults->get("THRESHOLD", config.threshold); + config.decay = defaults->get("DECAY", config.decay); } +int BurnMain::save_defaults() +{ + defaults->update("THRESHOLD", config.threshold); + defaults->update("DECAY", config.decay); +}*/ + +LOAD_CONFIGURATION_MACRO(BurnMain, BurnConfig) void BurnMain::save_data(KeyFrame *keyframe) { + FileXML output; + + output.set_shared_output(keyframe->xbuf); + + output.tag.set_title("BURNTV"); + output.tag.set_property("THRESHOLD", config.threshold); + output.tag.set_property("DECAY", config.decay); + output.append_tag(); + output.tag.set_title("/BURNTV"); + output.append_tag(); + output.append_newline(); + output.terminate_string(); } void BurnMain::read_data(KeyFrame *keyframe) { + FileXML input; + input.set_shared_input(keyframe->xbuf); + + while(!input.read_tag()) + { + if(input.tag.title_is("BURNTV")) + { + config.threshold = input.tag.get_property("THRESHOLD", + config.threshold); + config.decay = input.tag.get_property("DECAY", config.decay); + } + } } + + #define MAXCOLOR 120 void BurnMain::HSItoRGB(double H, @@ -439,4 +495,3 @@ BurnPackage::BurnPackage() } - diff --git a/cinelerra-5.1/plugins/burn/burn.h b/cinelerra-5.1/plugins/burn/burn.h index 22fbfc88..21ad1abd 100644 --- a/cinelerra-5.1/plugins/burn/burn.h +++ b/cinelerra-5.1/plugins/burn/burn.h @@ -37,6 +37,13 @@ class BurnConfig { public: BurnConfig(); + ~BurnConfig(); + + void reset(); + int equivalent(BurnConfig &that); + void copy_from(BurnConfig &that); + void interpolate(BurnConfig &prev, + BurnConfig &next, int64_t prev_frame, int64_t next_frame, int64_t current_frame); int threshold; int decay; double recycle; // Seconds to a recycle @@ -82,13 +89,12 @@ public: int process_realtime(VFrame *input_ptr, VFrame *output_ptr); int is_realtime(); PLUGIN_CLASS_MEMBERS(BurnConfig); + void save_data(KeyFrame *keyframe); void read_data(KeyFrame *keyframe); - - void HSItoRGB(double H, double S, double I, @@ -99,6 +105,7 @@ public: void make_palette(int color_model); BurnServer *burn_server; + BurnClient *burn_client; int palette[3][256]; unsigned char *buffer; diff --git a/cinelerra-5.1/plugins/burn/burnwindow.C b/cinelerra-5.1/plugins/burn/burnwindow.C index 9d6a5d70..d7eb70ce 100644 --- a/cinelerra-5.1/plugins/burn/burnwindow.C +++ b/cinelerra-5.1/plugins/burn/burnwindow.C @@ -26,12 +26,6 @@ - - - - - - BurnWindow::BurnWindow(BurnMain *client) : PluginClientWindow(client, xS(300), @@ -47,13 +41,49 @@ BurnWindow::~BurnWindow() { } +/*void BurnWindow::update() +{ + threshold->update(client->config.threshold); + decay->update(client->config.decay); +}*/ + + +BurnSize::BurnSize(BurnMain *client, int x, int y, int w, + int min, int max, int *output) + : BC_ISlider(x, y, 0, 200, 200, min, max, *output) +{ + this->plugin = plugin; + this->output = output; +} + +int BurnSize::handle_event() +{ + int ret = BC_ISlider::handle_event(); + plugin->send_configure_change(); + return ret; +} + + + void BurnWindow::create_objects() { + BC_WindowBase *win; + int title_h; + + int xs10 = xS(10); int x = xS(10), y = yS(10); - add_subwindow(new BC_Title(x, y, - _("BurningTV from EffectTV\n" - "Copyright (C) 2001 FUKUCHI Kentarou") - )); + add_subwindow(win = new BC_Title(x, y, _("Threshold"))); + title_h = win->get_h() + 8; + y += title_h; + add_subwindow(threshold = new BurnSize(client, x+xs10, y, yS(10), + 0, 100, &client->config.threshold)); + y += threshold->get_h() + 8; + add_subwindow(win = new BC_Title(x, y, _("Decay"))); + y += title_h; + add_subwindow(decay = new BurnSize(client, x+xs10, y, yS(10), + 0, 50, &client->config.decay)); + + show_window(); flush(); diff --git a/cinelerra-5.1/plugins/burn/burnwindow.h b/cinelerra-5.1/plugins/burn/burnwindow.h index 636d5405..e0dd6cb3 100644 --- a/cinelerra-5.1/plugins/burn/burnwindow.h +++ b/cinelerra-5.1/plugins/burn/burnwindow.h @@ -22,6 +22,7 @@ #ifndef BURNWINDOW_H #define BURNWINDOW_H +#include "bcslider.h" #include "guicast.h" class BurnThread; @@ -31,6 +32,18 @@ class BurnWindow; #include "mutex.h" #include "burn.h" +class BurnSize : public BC_ISlider +{ +public: + BurnSize(BurnMain *plugin, int x, int y, + int w, int min, int max, int *output); + + int handle_event(); + BurnMain *plugin; + int *output; +}; + + @@ -42,10 +55,12 @@ public: void create_objects(); - BurnMain *client; -}; + BurnMain *client; + BurnSize *threshold; + BurnSize *decay; +};
-- Cin mailing list Cin@lists.cinelerra-gg.org https://lists.cinelerra-gg.org/mailman/listinfo/cin