Histograms restored.
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include <string>
|
||||
#include <guiutils.h>
|
||||
#include <multilangmgr.h>
|
||||
#include <LUT.h>
|
||||
|
||||
extern Glib::ustring argv0;
|
||||
|
||||
@@ -89,7 +90,7 @@ CurveEditor::CurveEditor (Glib::ustring text, CurveEditorGroup* ceGroup, CurveEd
|
||||
bgHistValid = false;
|
||||
selected = DCT_Linear;
|
||||
|
||||
histogram = new unsigned int[256]; // histogram values
|
||||
histogram(256); // histogram values
|
||||
|
||||
group = ceGroup;
|
||||
subGroup = ceSubGroup;
|
||||
@@ -107,7 +108,6 @@ CurveEditor::CurveEditor (Glib::ustring text, CurveEditorGroup* ceGroup, CurveEd
|
||||
|
||||
CurveEditor::~CurveEditor () {
|
||||
|
||||
delete [] histogram;
|
||||
}
|
||||
|
||||
void CurveEditor::setCurve (const std::vector<double>& p) {
|
||||
@@ -134,10 +134,10 @@ void CurveEditor::setUnChanged (bool uc) {
|
||||
/*
|
||||
* Update the backgrounds histograms
|
||||
*/
|
||||
void CurveEditor::updateBackgroundHistogram (unsigned int* hist) {
|
||||
void CurveEditor::updateBackgroundHistogram (LUTu & hist) {
|
||||
// Copy the histogram in the curve editor cache
|
||||
if (hist!=NULL) {
|
||||
memcpy (histogram, hist, 256*sizeof(unsigned int));
|
||||
if (hist) {
|
||||
histogram=hist;
|
||||
bgHistValid = true;
|
||||
}
|
||||
else
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#define _CURVEEDITOR_
|
||||
|
||||
#include <popuptogglebutton.h>
|
||||
#include <LUT.h>
|
||||
|
||||
class CurveEditorGroup;
|
||||
class CurveEditorSubGroup;
|
||||
@@ -51,7 +52,7 @@ class CurveEditor {
|
||||
*/
|
||||
|
||||
PopUpToggleButton* curveType;
|
||||
unsigned int* histogram; // histogram values
|
||||
LUTu histogram; // histogram values
|
||||
bool bgHistValid;
|
||||
|
||||
int selected;
|
||||
@@ -70,7 +71,7 @@ class CurveEditor {
|
||||
void curveTypeToggled();
|
||||
bool isUnChanged ();
|
||||
void setUnChanged (bool uc);
|
||||
void updateBackgroundHistogram (unsigned int* hist);
|
||||
void updateBackgroundHistogram (LUTu & hist);
|
||||
void setCurve (const std::vector<double>& p);
|
||||
virtual std::vector<double> getCurve () = 0;
|
||||
};
|
||||
|
@@ -323,10 +323,10 @@ void DiagonalCurveEditorSubGroup::storeDisplayedCurve() {
|
||||
* Restore the histogram to all types from the CurveEditor object to the widgets
|
||||
*/
|
||||
void DiagonalCurveEditorSubGroup::restoreDisplayedHistogram() {
|
||||
if (parent->displayedCurve) {
|
||||
paramCurve->updateBackgroundHistogram (parent->displayedCurve->bgHistValid ? parent->displayedCurve->histogram : NULL);
|
||||
customCurve->updateBackgroundHistogram (parent->displayedCurve->bgHistValid ? parent->displayedCurve->histogram : NULL);
|
||||
NURBSCurve->updateBackgroundHistogram (parent->displayedCurve->bgHistValid ? parent->displayedCurve->histogram : NULL);
|
||||
if (parent->displayedCurve /*&& initslope==1*/) {
|
||||
paramCurve->updateBackgroundHistogram (parent->displayedCurve->histogram);
|
||||
customCurve->updateBackgroundHistogram (parent->displayedCurve->histogram);
|
||||
NURBSCurve->updateBackgroundHistogram (parent->displayedCurve->histogram);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -465,9 +465,9 @@ bool DiagonalCurveEditorSubGroup::adjusterLeft (GdkEventCrossing* ev, int ac) {
|
||||
}
|
||||
|
||||
void DiagonalCurveEditorSubGroup::updateBackgroundHistogram (CurveEditor* ce) {
|
||||
if (ce==parent->displayedCurve) {
|
||||
paramCurve->updateBackgroundHistogram (ce->bgHistValid ? ce->histogram : NULL);
|
||||
customCurve->updateBackgroundHistogram (ce->bgHistValid ? ce->histogram : NULL);
|
||||
NURBSCurve->updateBackgroundHistogram (ce->bgHistValid ? ce->histogram : NULL);
|
||||
if (ce==parent->displayedCurve /*&& initslope==1*/) {
|
||||
paramCurve->updateBackgroundHistogram (ce->histogram);
|
||||
customCurve->updateBackgroundHistogram (ce->histogram);
|
||||
NURBSCurve->updateBackgroundHistogram (ce->histogram);
|
||||
}
|
||||
}
|
||||
|
@@ -1275,7 +1275,7 @@ void EditorPanel::beforeAfterToggled () {
|
||||
}
|
||||
}
|
||||
|
||||
void EditorPanel::histogramChanged (unsigned int* rh, unsigned int* gh, unsigned int* bh, unsigned int* lh, unsigned int* bcrgb, unsigned int* bcl) {
|
||||
void EditorPanel::histogramChanged (LUTu & rh, LUTu & gh, LUTu & bh, LUTu & lh, LUTu & bcrgb, LUTu & bcl) {
|
||||
|
||||
histogramPanel->histogramChanged (rh, gh, bh, lh);
|
||||
tpc->updateCurveBackgroundHistogram (bcrgb, bcl);
|
||||
|
@@ -149,7 +149,7 @@ class EditorPanel : public Gtk::VBox,
|
||||
void historyBeforeLineChanged (const rtengine::procparams::ProcParams& params);
|
||||
|
||||
// HistogramListener
|
||||
void histogramChanged (unsigned int* rh, unsigned int* gh, unsigned int* bh, unsigned int* lh, unsigned int* bcrgb, unsigned int* bcl);
|
||||
void histogramChanged (LUTu & rh, LUTu & gh, LUTu & bh, LUTu & lh, LUTu & bcrgb, LUTu & bcl);
|
||||
|
||||
// event handlers
|
||||
void info_toggled ();
|
||||
|
@@ -193,8 +193,8 @@ void FlatCurveEditorSubGroup::storeDisplayedCurve() {
|
||||
*/
|
||||
void FlatCurveEditorSubGroup::restoreDisplayedHistogram() {
|
||||
if (parent->displayedCurve) {
|
||||
//paramCurve->updateBackgroundHistogram (parent->displayedCurve->bgHistValid ? parent->displayedCurve->histogram : NULL);
|
||||
CPointsCurve->updateBackgroundHistogram (parent->displayedCurve->bgHistValid ? parent->displayedCurve->histogram : NULL);
|
||||
//paramCurve->updateBackgroundHistogram (parent->displayedCurve->histogram);
|
||||
CPointsCurve->updateBackgroundHistogram (parent->displayedCurve->histogram);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -19,6 +19,8 @@
|
||||
#include <histogrampanel.h>
|
||||
#include <multilangmgr.h>
|
||||
#include <string.h>
|
||||
#include <LUT.h>
|
||||
|
||||
|
||||
HistogramPanel::HistogramPanel () {
|
||||
|
||||
@@ -77,10 +79,10 @@ void HistogramPanel::rgbv_toggled () {
|
||||
HistogramArea::HistogramArea () :
|
||||
valid(false), showFull(true), oldwidth(-1), needVal(true), needRed(true), needGreen(true), needBlue(true) {
|
||||
|
||||
lhist = new unsigned int[256];
|
||||
rhist = new unsigned int[256];
|
||||
ghist = new unsigned int[256];
|
||||
bhist = new unsigned int[256];
|
||||
lhist(256);
|
||||
rhist(256);
|
||||
ghist(256);
|
||||
bhist(256);
|
||||
|
||||
haih = new HistogramAreaIdleHelper;
|
||||
haih->harea = this;
|
||||
@@ -97,10 +99,6 @@ HistogramArea::~HistogramArea () {
|
||||
else
|
||||
delete haih;
|
||||
|
||||
delete [] lhist;
|
||||
delete [] rhist;
|
||||
delete [] ghist;
|
||||
delete [] bhist;
|
||||
}
|
||||
|
||||
void HistogramArea::updateOptions (bool r, bool g, bool b, bool v) {
|
||||
@@ -136,13 +134,13 @@ int histupdate (void* data) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HistogramArea::update (unsigned int* rh, unsigned int* gh, unsigned int* bh, unsigned int* lh) {
|
||||
void HistogramArea::update (LUTu & rh, LUTu & gh, LUTu & bh, LUTu & lh) {
|
||||
|
||||
if (rh!=NULL) {
|
||||
memcpy (lhist, lh, 256*sizeof(unsigned int));
|
||||
memcpy (rhist, rh, 256*sizeof(unsigned int));
|
||||
memcpy (ghist, gh, 256*sizeof(unsigned int));
|
||||
memcpy (bhist, bh, 256*sizeof(unsigned int));
|
||||
if (rh) {
|
||||
lhist=lh;
|
||||
rhist=rh;
|
||||
ghist=gh;
|
||||
bhist=bh;
|
||||
valid = true;
|
||||
}
|
||||
else
|
||||
@@ -427,7 +425,7 @@ void HistogramArea::on_realize () {
|
||||
}
|
||||
|
||||
void HistogramArea::drawCurve(Cairo::RefPtr<Cairo::Context> &cr,
|
||||
unsigned int * data, double scale, int hsize, int vsize)
|
||||
LUTu & data, double scale, int hsize, int vsize)
|
||||
{
|
||||
cr->move_to (0, vsize-1);
|
||||
for (int i = 0; i < 256; i++) {
|
||||
@@ -440,7 +438,7 @@ void HistogramArea::drawCurve(Cairo::RefPtr<Cairo::Context> &cr,
|
||||
}
|
||||
|
||||
void HistogramArea::drawMarks(Cairo::RefPtr<Cairo::Context> &cr,
|
||||
unsigned int * data, double scale, int hsize, int & ui, int & oi)
|
||||
LUTu & data, double scale, int hsize, int & ui, int & oi)
|
||||
{
|
||||
int s = 8;
|
||||
|
||||
|
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <gtkmm.h>
|
||||
#include <glibmm.h>
|
||||
#include <LUT.h>
|
||||
|
||||
class HistogramArea;
|
||||
struct HistogramAreaIdleHelper {
|
||||
@@ -44,10 +45,10 @@ class HistogramArea : public Gtk::DrawingArea {
|
||||
Gdk::Color lgray;
|
||||
Gdk::Color mgray;
|
||||
Gdk::Color dgray;
|
||||
unsigned int* lhist;
|
||||
unsigned int* rhist;
|
||||
unsigned int* ghist;
|
||||
unsigned int* bhist;
|
||||
LUTu lhist;
|
||||
LUTu rhist;
|
||||
LUTu ghist;
|
||||
LUTu bhist;
|
||||
bool valid;
|
||||
bool showFull;
|
||||
int oldwidth, oldheight;
|
||||
@@ -65,7 +66,7 @@ class HistogramArea : public Gtk::DrawingArea {
|
||||
~HistogramArea();
|
||||
|
||||
void renderHistogram ();
|
||||
void update (unsigned int* rh, unsigned int* gh, unsigned int* bh, unsigned int* lh);
|
||||
void update (LUTu &rh, LUTu &gh, LUTu &bh, LUTu &lh);
|
||||
void updateOptions (bool r, bool g, bool b, bool v);
|
||||
void on_realize();
|
||||
bool on_expose_event(GdkEventExpose* event);
|
||||
@@ -73,9 +74,9 @@ class HistogramArea : public Gtk::DrawingArea {
|
||||
void styleChanged (const Glib::RefPtr<Gtk::Style>& style);
|
||||
private:
|
||||
void drawCurve(Cairo::RefPtr<Cairo::Context> &cr,
|
||||
unsigned int * data, double scale, int hsize, int vsize);
|
||||
LUTu & data, double scale, int hsize, int vsize);
|
||||
void drawMarks(Cairo::RefPtr<Cairo::Context> &cr,
|
||||
unsigned int * data, double scale, int hsize, int & ui, int & oi);
|
||||
LUTu & data, double scale, int hsize, int & ui, int & oi);
|
||||
};
|
||||
|
||||
class HistogramPanel : public Gtk::HBox {
|
||||
@@ -94,7 +95,7 @@ class HistogramPanel : public Gtk::HBox {
|
||||
|
||||
HistogramPanel ();
|
||||
|
||||
void histogramChanged (unsigned int* rh, unsigned int* gh, unsigned int* bh, unsigned int* lh) { histogramArea->update (rh, gh, bh, lh); }
|
||||
void histogramChanged (LUTu &rh, LUTu &gh, LUTu &bh, LUTu &lh) { histogramArea->update (rh, gh, bh, lh); }
|
||||
void rgbv_toggled ();
|
||||
void resized (Gtk::Allocation& req);
|
||||
};
|
||||
|
@@ -359,7 +359,7 @@ void LCurve::setAdjusterBehavior (bool bradd, bool contradd, bool satadd) {
|
||||
|
||||
}
|
||||
|
||||
void LCurve::updateCurveBackgroundHistogram (unsigned* hist) {
|
||||
void LCurve::updateCurveBackgroundHistogram (LUTu & hist) {
|
||||
|
||||
lshape->updateBackgroundHistogram (hist);
|
||||
}
|
||||
|
@@ -65,7 +65,7 @@ class LCurve : public Gtk::VBox, public AdjusterListener, public FoldableToolPan
|
||||
void adjusterChanged (Adjuster* a, double newval);
|
||||
void avoidclip_toggled ();
|
||||
void enablelimiter_toggled ();
|
||||
void updateCurveBackgroundHistogram (unsigned* hist);
|
||||
void updateCurveBackgroundHistogram (LUTu & hist);
|
||||
|
||||
virtual void colorForValue (double valX, double valY);
|
||||
};
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include <curvelistener.h>
|
||||
#include <cursormanager.h>
|
||||
#include <colorprovider.h>
|
||||
#include <LUT.h>
|
||||
|
||||
#define RADIUS 3 /* radius of the control points */
|
||||
#define SQUARE 2 /* half length of the square shape of the tangent handles */
|
||||
@@ -83,7 +84,7 @@ class MyCurve : public Gtk::DrawingArea {
|
||||
void setCurveListener (CurveListener* cl) { listener = cl; }
|
||||
void setColorProvider (ColorProvider* cp) { colorProvider = cp; }
|
||||
void notifyListener ();
|
||||
void updateBackgroundHistogram (unsigned int* hist) {return;} ;
|
||||
void updateBackgroundHistogram (LUTu & hist) {return;} ;
|
||||
void forceResize() { sized = RS_Force; }
|
||||
virtual std::vector<double> getPoints () = 0;
|
||||
virtual void setPoints (const std::vector<double>& p) = 0;
|
||||
|
@@ -656,10 +656,12 @@ int diagonalmchistupdate (void* data) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MyDiagonalCurve::updateBackgroundHistogram (unsigned int* hist) {
|
||||
void MyDiagonalCurve::updateBackgroundHistogram (LUTu & hist) {
|
||||
|
||||
if (hist!=NULL) {
|
||||
memcpy (bghist, hist, 256*sizeof(unsigned int));
|
||||
//memcpy (bghist, hist, 256*sizeof(unsigned int));
|
||||
for (int i=0; i<256; i++) bghist[i]=hist[i];
|
||||
//hist = bghist;
|
||||
bghistvalid = true;
|
||||
}
|
||||
else
|
||||
|
@@ -24,6 +24,8 @@
|
||||
#include <curvelistener.h>
|
||||
#include <cursormanager.h>
|
||||
#include <mycurve.h>
|
||||
#include <LUT.h>
|
||||
|
||||
|
||||
// For compatibility and simplicity reason, order shouldn't change, and must be identical to the order specified in the curveType widget
|
||||
enum DiagonalCurveType {
|
||||
@@ -76,7 +78,7 @@ class MyDiagonalCurve : public MyCurve {
|
||||
bool handleEvents (GdkEvent* event);
|
||||
void setActiveParam (int ac);
|
||||
void reset ();
|
||||
void updateBackgroundHistogram (unsigned int* hist);
|
||||
void updateBackgroundHistogram (LUTu & hist);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -393,7 +393,7 @@ void ToneCurve::setAdjusterBehavior (bool expadd, bool hlcompadd, bool hlcompthr
|
||||
satAdd = satadd;
|
||||
}
|
||||
|
||||
void ToneCurve::updateCurveBackgroundHistogram (unsigned* hist) {
|
||||
void ToneCurve::updateCurveBackgroundHistogram (LUTu & hist) {
|
||||
|
||||
shape->updateBackgroundHistogram (hist);
|
||||
}
|
||||
|
@@ -69,7 +69,7 @@ class ToneCurve : public Gtk::VBox, public AdjusterListener, public FoldableTool
|
||||
void curveChanged ();
|
||||
void expandCurve (bool isExpanded);
|
||||
bool isCurveExpanded ();
|
||||
void updateCurveBackgroundHistogram (unsigned* hist);
|
||||
void updateCurveBackgroundHistogram (LUTu & hist);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -470,7 +470,7 @@ int ToolPanelCoordinator::getSpotWBRectSize () {
|
||||
return whitebalance->getSize ();
|
||||
}
|
||||
|
||||
void ToolPanelCoordinator::updateCurveBackgroundHistogram (unsigned* histrgb, unsigned* histl) {
|
||||
void ToolPanelCoordinator::updateCurveBackgroundHistogram (LUTu &histrgb, LUTu &histl) {
|
||||
|
||||
curve->updateCurveBackgroundHistogram (histrgb);
|
||||
lcurve->updateCurveBackgroundHistogram (histl);
|
||||
|
@@ -149,7 +149,7 @@ class ToolPanelCoordinator : public ToolPanelListener,
|
||||
~ToolPanelCoordinator ();
|
||||
|
||||
bool getChangedState () { return hasChanged; }
|
||||
void updateCurveBackgroundHistogram (unsigned* histrgb, unsigned* histl);
|
||||
void updateCurveBackgroundHistogram (LUTu & histrgb, LUTu & histl);
|
||||
void foldAllButOne (Gtk::Box* parent, FoldableToolPanel* openedSection);
|
||||
|
||||
// multiple listeners can be added that are notified on changes (typical: profile panel and the history)
|
||||
|
Reference in New Issue
Block a user