Toshihiro Shimizu 890ddd
#ifndef COMBOHISTOGRAM_H
Toshihiro Shimizu 890ddd
#define COMBOHISTOGRAM_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Toshihiro Shimizu 890ddd
#include "traster.h"
Toshihiro Shimizu 890ddd
#include "ttoonzimage.h"
Toshihiro Shimizu 890ddd
#include "tpalette.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <qwidget></qwidget>
Toshihiro Shimizu 890ddd
#include <qstackedwidget></qstackedwidget>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TOONZQT_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
#pragma warning(disable : 4251)
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class QStackedWidget;
Toshihiro Shimizu 890ddd
class QString;
Toshihiro Shimizu 890ddd
class QComboBox;
Toshihiro Shimizu 890ddd
class QColor;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class RGBLabel;
Toshihiro Shimizu 890ddd
class QLabel;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define COMBOHIST_RESOLUTION_W 256
Toshihiro Shimizu 890ddd
#define COMBOHIST_RESOLUTION_H 100
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
// 120405
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI ComboHistoRGBLabel : public QWidget
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	QColor m_color;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	ComboHistoRGBLabel(QColor color, QWidget *parent);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	~ComboHistoRGBLabel() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setColorAndUpdate(QColor color);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	void paintEvent(QPaintEvent *pe);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI ChannelHistoGraph : public QWidget
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	QVector<int> m_values;</int>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int m_pickedValue;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	int *m_channelValuePtr;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	ChannelHistoGraph(QWidget *parent = 0, int *channelValue = 0);
Toshihiro Shimizu 890ddd
	~ChannelHistoGraph();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void setValues();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void showCurrentChannelValue(int val);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	virtual void paintEvent(QPaintEvent *event);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI RGBHistoGraph : public ChannelHistoGraph
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	QVector<int> m_rgbValues[3];</int>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	QImage m_histoImg;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	RGBHistoGraph(QWidget *parent = 0, int *channelValue = 0);
Toshihiro Shimizu 890ddd
	~RGBHistoGraph();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setValues();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	void paintEvent(QPaintEvent *event);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI ChannelColorBar : public QWidget
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	Q_OBJECT
Toshihiro Shimizu 890ddd
	QColor m_color;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	ChannelColorBar(QWidget *parent = 0, QColor m_color = QColor());
Toshihiro Shimizu 890ddd
	~ChannelColorBar() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	void paintEvent(QPaintEvent *event);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI ChannelHisto : public QWidget
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	ChannelHistoGraph *m_histogramGraph;
Toshihiro Shimizu 890ddd
	ChannelColorBar *m_colorBar;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	ChannelHisto(int channelIndex, int *channelValue, QWidget *parent = 0);
Toshihiro Shimizu 890ddd
	~ChannelHisto() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void refleshValue()
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		m_histogramGraph->setValues();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void showCurrentChannelValue(int val);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Toshihiro Shimizu 890ddd
	void onShowAlphaButtonToggled(bool visible);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI ComboHistogram : public QWidget
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TRasterP m_raster;
Toshihiro Shimizu 890ddd
	TPaletteP m_palette;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//rgba channels
Toshihiro Shimizu 890ddd
	int m_channelValue[4][COMBOHIST_RESOLUTION_W];
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//rgba channels + composited
Toshihiro Shimizu 890ddd
	ChannelHisto *m_histograms[5];
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	ComboHistoRGBLabel *m_rgbLabel;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	ComboHistoRGBLabel *m_rectAverageRgbLabel;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	QLabel *m_xPosLabel;
Toshihiro Shimizu 890ddd
	QLabel *m_yPosLabel;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	ComboHistogram(QWidget *parent = 0);
Toshihiro Shimizu 890ddd
	~ComboHistogram();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TRasterP getRaster() const { return m_raster; }
Toshihiro Shimizu 890ddd
	void setRaster(const TRasterP &raster, const TPaletteP &palette = 0);
Toshihiro Shimizu 890ddd
	void updateInfo(const TPixel32 &pix, const TPointD &imagePos);
Toshihiro Shimizu 890ddd
	void updateAverageColor(const TPixel32 &pix);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	void computeChannelsValue();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif