summaryrefslogtreecommitdiffstats
path: root/src/libs/widgets/common/curveswidget.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/widgets/common/curveswidget.h')
-rw-r--r--src/libs/widgets/common/curveswidget.h132
1 files changed, 132 insertions, 0 deletions
diff --git a/src/libs/widgets/common/curveswidget.h b/src/libs/widgets/common/curveswidget.h
new file mode 100644
index 00000000..c9cfed4a
--- /dev/null
+++ b/src/libs/widgets/common/curveswidget.h
@@ -0,0 +1,132 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2004-12-01
+ * Description : a widget to draw histogram curves
+ *
+ * Copyright (C) 2004-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * ============================================================ */
+
+#ifndef CURVESWIDGET_H
+#define CURVESWIDGET_H
+
+// TQt includes.
+
+#include <tqwidget.h>
+
+// Local includes.
+
+#include "dcolor.h"
+#include "digikam_export.h"
+
+class TQCustomEvent;
+
+namespace Digikam
+{
+
+class ImageHistogram;
+class ImageCurves;
+class CurvesWidgetPriv;
+
+class DIGIKAM_EXPORT CurvesWidget : public TQWidget
+{
+TQ_OBJECT
+
+
+public:
+
+ enum HistogramType
+ {
+ ValueHistogram = 0, // Luminosity.
+ RedChannelHistogram, // Red channel.
+ GreenChannelHistogram, // Green channel.
+ BlueChannelHistogram, // Blue channel.
+ AlphaChannelHistogram, // Alpha channel.
+ };
+
+ enum HistogramScale
+ {
+ LinScaleHistogram=0, // Linear scale.
+ LogScaleHistogram // Logarithmic scale.
+ };
+
+public:
+
+ CurvesWidget(int w, int h, TQWidget *parent, bool readOnly=false);
+
+ CurvesWidget(int w, int h, // Widget size.
+ uchar *i_data, uint i_w, uint i_h, // Full image info.
+ bool i_sixteenBits, // 8 or 16 bits image.
+ TQWidget *parent=0, // Parent widget instance.
+ bool readOnly=false); // If true : widget with full edition mode capabilities.
+ // If false : display curve data only without edition.
+
+ ~CurvesWidget();
+
+ void setup(int w, int h, bool readOnly);
+ void updateData(uchar *i_data, uint i_w, uint i_h, bool i_sixteenBits);
+
+ // Stop current histogram computations.
+ void stopHistogramComputation();
+
+ void setDataLoading();
+ void setLoadingFailed();
+
+ void reset();
+ void curveTypeChanged();
+ void setCurveGuide(const DColor& color);
+
+ ImageCurves* curves() const;
+
+public:
+
+ int m_channelType; // Channel type to draw.
+ int m_scaleType; // Scale to use for drawing.
+
+ ImageHistogram *m_imageHistogram;
+
+signals:
+
+ void signalMouseMoved( int x, int y );
+ void signalCurvesChanged();
+ void signalHistogramComputationDone();
+ void signalHistogramComputationFailed();
+
+protected slots:
+
+ void slotBlinkTimerDone();
+
+protected:
+
+ void paintEvent(TQPaintEvent*);
+ void mousePressEvent(TQMouseEvent*);
+ void mouseReleaseEvent(TQMouseEvent*);
+ void mouseMoveEvent(TQMouseEvent*);
+ void leaveEvent(TQEvent*);
+
+private:
+
+ void customEvent(TQCustomEvent *event);
+
+private:
+
+ CurvesWidgetPriv* d;
+};
+
+} // NameSpace Digikam
+
+#endif /* CURVESWIDGET_H */