Hello everyone,
since my last e-mail regarding this small patch of mine I neither got
any comments nor saw it being commited to SVN, so I guess it has been
eaten by some spam-filters (likely, as there was something wrong with my
server setup)...
So I'm broadcasting my patch again (this time as svn-diff), hoping I
don't annoy somebody and that I get some comments...
(Short description: it adds an extra button to the histogram plugin to
split the output picture into one half that is color-corrected and
another that is not.)
Thanks for your time,
Jonas
Index: histogramconfig.C
===================================================================
--- histogramconfig.C (Revision 735)
+++ histogramconfig.C (Arbeitskopie)
@@ -163,6 +163,7 @@
{
automatic = 0;
threshold = 0.1;
+ split = 0;
}
}
@@ -214,6 +215,7 @@
automatic = that.automatic;
threshold = that.threshold;
+ split = that.split;
}
void HistogramConfig::interpolate(HistogramConfig &prev,
@@ -234,6 +236,7 @@
threshold = prev.threshold * prev_scale + next.threshold * next_scale;
automatic = prev.automatic;
+ split = prev.split;
}
Index: histogramwindow.C
===================================================================
--- histogramwindow.C (Revision 735)
+++ histogramwindow.C (Arbeitskopie)
@@ -180,8 +180,10 @@
y,
&plugin->config.threshold);
threshold->create_objects();
+ x = x1;
+ y += 40;
+ add_subwindow(split = new HistogramSplit(plugin, x, y));
-
show_window();
return 0;
@@ -665,9 +667,6 @@
-
-
-
HistogramAuto::HistogramAuto(HistogramMain *plugin,
int x,
int y)
@@ -684,8 +683,22 @@
}
+HistogramSplit::HistogramSplit(HistogramMain *plugin,
+ int x,
+ int y)
+ : BC_CheckBox(x, y, plugin->config.split, _("Split picture"))
+{
+ this->plugin = plugin;
+}
+int HistogramSplit::handle_event()
+{
+ plugin->config.split = get_value();
+ plugin->send_configure_change();
+ return 1;
+}
+
HistogramMode::HistogramMode(HistogramMain *plugin,
int x,
int y,
Index: histogramconfig.h
===================================================================
--- histogramconfig.h (Revision 735)
+++ histogramconfig.h (Arbeitskopie)
@@ -61,6 +61,7 @@
float output_max[HISTOGRAM_MODES];
int automatic;
float threshold;
+ int split;
};
Index: histogramwindow.h
===================================================================
--- histogramwindow.h (Revision 735)
+++ histogramwindow.h (Arbeitskopie)
@@ -49,6 +49,17 @@
HistogramMain *plugin;
};
+class HistogramSplit : public BC_CheckBox
+{
+public:
+ HistogramSplit(HistogramMain *plugin,
+ int x,
+ int y);
+ int handle_event();
+ HistogramMain *plugin;
+};
+
+
class HistogramMode : public BC_Radial
{
public:
@@ -136,6 +147,7 @@
HistogramSlider *output;
HistogramAuto *automatic;
+ HistogramSplit *split;
HistogramMode *mode_v, *mode_r, *mode_g, *mode_b /*, *mode_a */;
HistogramOutputText *output_min;
HistogramOutputText *output_max;
Index: histogram.C
===================================================================
--- histogram.C (Revision 735)
+++ histogram.C (Arbeitskopie)
@@ -171,6 +171,7 @@
mode = defaults->get("MODE", mode);
CLAMP(mode, 0, HISTOGRAM_MODES - 1);
config.threshold = defaults->get("THRESHOLD", config.threshold);
+ config.split = defaults->get("SPLIT", config.split);
config.boundaries();
return 0;
}
@@ -212,6 +213,7 @@
defaults->update("AUTOMATIC", config.automatic);
defaults->update("MODE", mode);
defaults->update("THRESHOLD", config.threshold);
+ defaults->update("SPLIT", config.split);
defaults->save();
return 0;
}
@@ -240,6 +242,7 @@
output.tag.set_property("AUTOMATIC", config.automatic);
output.tag.set_property("THRESHOLD", config.threshold);
+ output.tag.set_property("SPLIT", config.split);
output.append_tag();
output.append_newline();
@@ -308,6 +311,7 @@
}
config.automatic = input.tag.get_property("AUTOMATIC", config.automatic);
config.threshold = input.tag.get_property("THRESHOLD", config.threshold);
+ config.split = input.tag.get_property("SPLIT", config.split);
}
else
if(input.tag.title_is("POINTS"))
@@ -841,6 +845,11 @@
type *row = (type*)input->get_rows()[i]; \
for(int j = 0; j < w; j++) \
{ \
+ if (plugin->config.split) \
+ { \
+ if ((j + i * w / h) < w) \
+ continue; \
+ } \
row[0] = lookup_r[row[0]]; \
row[1] = lookup_g[row[1]]; \
row[2] = lookup_b[row[2]]; \
@@ -856,6 +865,11 @@
type *row = (type*)input->get_rows()[i]; \
for(int j = 0; j < w; j++) \
{ \
+ if (plugin->config.split) \
+ { \
+ if ((j + i * w / h) < w) \
+ continue; \
+ } \
/* Convert to 16 bit RGB */ \
if(max == 0xff) \
{ \
@@ -904,6 +918,11 @@
float *row = (float*)input->get_rows()[i]; \
for(int j = 0; j < w; j++) \
{ \
+ if (plugin->config.split) \
+ { \
+ if ((j + i * w / h) < w) \
+ continue; \
+ } \
float r = row[0]; \
float g = row[1]; \
float b = row[2]; \