2016-05-17 03:04:11 +12:00
|
|
|
#pragma once
|
|
|
|
|
2016-03-19 06:57:51 +13:00
|
|
|
#ifndef COMBOHISTOGRAM_H
|
|
|
|
#define COMBOHISTOGRAM_H
|
|
|
|
|
|
|
|
#include "tcommon.h"
|
|
|
|
#include "traster.h"
|
|
|
|
#include "ttoonzimage.h"
|
|
|
|
#include "tpalette.h"
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QStackedWidget>
|
|
|
|
|
|
|
|
#undef DVAPI
|
|
|
|
#undef DVVAR
|
|
|
|
#ifdef TOONZQT_EXPORTS
|
|
|
|
#define DVAPI DV_EXPORT_API
|
|
|
|
#define DVVAR DV_EXPORT_VAR
|
|
|
|
#else
|
|
|
|
#define DVAPI DV_IMPORT_API
|
|
|
|
#define DVVAR DV_IMPORT_VAR
|
|
|
|
#endif
|
|
|
|
|
2017-05-09 00:13:29 +12:00
|
|
|
#ifdef _MSC_VER
|
2016-03-19 06:57:51 +13:00
|
|
|
#pragma warning(disable : 4251)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class QStackedWidget;
|
|
|
|
class QString;
|
|
|
|
class QComboBox;
|
|
|
|
class QColor;
|
|
|
|
|
|
|
|
class RGBLabel;
|
|
|
|
class QLabel;
|
|
|
|
|
|
|
|
#define COMBOHIST_RESOLUTION_W 256
|
|
|
|
#define COMBOHIST_RESOLUTION_H 100
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// 120405
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI ComboHistoRGBLabel final : public QWidget {
|
2019-08-19 21:52:45 +12:00
|
|
|
Q_OBJECT
|
2016-06-15 18:43:10 +12:00
|
|
|
QColor m_color;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
ComboHistoRGBLabel(QColor color, QWidget *parent);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
~ComboHistoRGBLabel() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setColorAndUpdate(QColor color);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-19 20:06:29 +12:00
|
|
|
void paintEvent(QPaintEvent *pe) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI ChannelHistoGraph : public QWidget {
|
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QVector<int> m_values;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int m_pickedValue;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
int *m_channelValuePtr;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
ChannelHistoGraph(QWidget *parent = 0, int *channelValue = 0);
|
|
|
|
~ChannelHistoGraph();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
virtual void setValues();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void showCurrentChannelValue(int val);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-19 20:06:29 +12:00
|
|
|
void paintEvent(QPaintEvent *event) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI RGBHistoGraph final : public ChannelHistoGraph {
|
2016-06-15 18:43:10 +12:00
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QVector<int> m_rgbValues[3];
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QImage m_histoImg;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
RGBHistoGraph(QWidget *parent = 0, int *channelValue = 0);
|
|
|
|
~RGBHistoGraph();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void setValues() override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-19 20:06:29 +12:00
|
|
|
void paintEvent(QPaintEvent *event) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI ChannelColorBar final : public QWidget {
|
2016-06-15 18:43:10 +12:00
|
|
|
Q_OBJECT
|
|
|
|
QColor m_color;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
ChannelColorBar(QWidget *parent = 0, QColor m_color = QColor());
|
|
|
|
~ChannelColorBar() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-19 20:06:29 +12:00
|
|
|
void paintEvent(QPaintEvent *event) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI ChannelHisto final : public QWidget {
|
2016-06-15 18:43:10 +12:00
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
ChannelHistoGraph *m_histogramGraph;
|
|
|
|
ChannelColorBar *m_colorBar;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
ChannelHisto(int channelIndex, int *channelValue, QWidget *parent = 0);
|
|
|
|
~ChannelHisto() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void refleshValue() { m_histogramGraph->setValues(); }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void showCurrentChannelValue(int val);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void onShowAlphaButtonToggled(bool visible);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI ComboHistogram final : public QWidget {
|
2016-06-15 18:43:10 +12:00
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TRasterP m_raster;
|
|
|
|
TPaletteP m_palette;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// rgba channels
|
|
|
|
int m_channelValue[4][COMBOHIST_RESOLUTION_W];
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// rgba channels + composited
|
|
|
|
ChannelHisto *m_histograms[5];
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
ComboHistoRGBLabel *m_rgbLabel;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
ComboHistoRGBLabel *m_rectAverageRgbLabel;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QLabel *m_xPosLabel;
|
|
|
|
QLabel *m_yPosLabel;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
ComboHistogram(QWidget *parent = 0);
|
|
|
|
~ComboHistogram();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TRasterP getRaster() const { return m_raster; }
|
|
|
|
void setRaster(const TRasterP &raster, const TPaletteP &palette = 0);
|
|
|
|
void updateInfo(const TPixel32 &pix, const TPointD &imagePos);
|
|
|
|
void updateAverageColor(const TPixel32 &pix);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-15 18:43:10 +12:00
|
|
|
void computeChannelsValue();
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|