|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Shinya Kitaoka |
810553 |
|
|
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 |
|
|
|
e280ae |
#ifdef _MSC_VER
|
|
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 |
|
|
Shinya Kitaoka |
d1f6c4 |
class DVAPI ComboHistoRGBLabel final : public QWidget {
|
|
shun-iwasawa |
199e29 |
Q_OBJECT
|
|
shun-iwasawa |
d5045c |
public:
|
|
shun-iwasawa |
d5045c |
enum DisplayMode { Display_8bit = 0, Display_16bit, Display_0_1 };
|
|
shun-iwasawa |
d5045c |
|
|
shun-iwasawa |
d5045c |
private:
|
|
Shinya Kitaoka |
120a6e |
QColor m_color;
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
d5045c |
DisplayMode m_mode;
|
|
shun-iwasawa |
2cda63 |
bool m_alphaVisible;
|
|
shun-iwasawa |
d5045c |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ComboHistoRGBLabel(QColor color, QWidget *parent);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
~ComboHistoRGBLabel() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setColorAndUpdate(QColor color);
|
|
shun-iwasawa |
d5045c |
void setDisplayMode(DisplayMode mode) { m_mode = mode; }
|
|
shun-iwasawa |
2cda63 |
void setAlphaVisible(bool visible) { m_alphaVisible = visible; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
473e70 |
void paintEvent(QPaintEvent *pe) override;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class DVAPI ChannelHistoGraph : public QWidget {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
d5045c |
QVector<int> m_values[2]; // 0: current raster 1: snapshot</int>
|
|
shun-iwasawa |
d5045c |
int m_maxValue[2];
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int m_pickedValue;
|
|
shun-iwasawa |
d5045c |
int m_channelIndex;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
shun-iwasawa |
d5045c |
bool *m_showComparePtr;
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
d5045c |
ChannelHistoGraph(int index, QWidget *parent = nullptr,
|
|
shun-iwasawa |
d5045c |
bool *showComparePtr = nullptr);
|
|
Shinya Kitaoka |
120a6e |
~ChannelHistoGraph();
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
d5045c |
virtual void setValues(int *buf, bool isComp);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void showCurrentChannelValue(int val);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
473e70 |
void paintEvent(QPaintEvent *event) override;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class DVAPI RGBHistoGraph final : public ChannelHistoGraph {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QVector<int> m_rgbValues[3];</int>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QImage m_histoImg;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
shun-iwasawa |
d5045c |
RGBHistoGraph(int index, QWidget *parent = 0);
|
|
Shinya Kitaoka |
120a6e |
~RGBHistoGraph();
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
d5045c |
void setValues(int *buf, bool isComp) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
473e70 |
void paintEvent(QPaintEvent *event) override;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class DVAPI ChannelColorBar final : public QWidget {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Shinya Kitaoka |
120a6e |
QColor m_color;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ChannelColorBar(QWidget *parent = 0, QColor m_color = QColor());
|
|
Shinya Kitaoka |
120a6e |
~ChannelColorBar() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
473e70 |
void paintEvent(QPaintEvent *event) override;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class DVAPI ChannelHisto final : public QWidget {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ChannelHistoGraph *m_histogramGraph;
|
|
Shinya Kitaoka |
120a6e |
ChannelColorBar *m_colorBar;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
shun-iwasawa |
d5045c |
ChannelHisto(int channelIndex, bool *showComparePtr, QWidget *parent = 0);
|
|
Shinya Kitaoka |
120a6e |
~ChannelHisto() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
d5045c |
void refleshValue(int *buf, bool isComp = false) {
|
|
shun-iwasawa |
d5045c |
m_histogramGraph->setValues(buf, isComp);
|
|
shun-iwasawa |
d5045c |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void showCurrentChannelValue(int val);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Shinya Kitaoka |
120a6e |
void onShowAlphaButtonToggled(bool visible);
|
|
shun-iwasawa |
2cda63 |
|
|
shun-iwasawa |
2cda63 |
signals:
|
|
shun-iwasawa |
2cda63 |
void showButtonToggled(bool);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class DVAPI ComboHistogram final : public QWidget {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TRasterP m_raster;
|
|
Shinya Kitaoka |
120a6e |
TPaletteP m_palette;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// rgba channels
|
|
Shinya Kitaoka |
120a6e |
int m_channelValue[4][COMBOHIST_RESOLUTION_W];
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// rgba channels + composited
|
|
Shinya Kitaoka |
120a6e |
ChannelHisto *m_histograms[5];
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ComboHistoRGBLabel *m_rgbLabel;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ComboHistoRGBLabel *m_rectAverageRgbLabel;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QLabel *m_xPosLabel;
|
|
Shinya Kitaoka |
120a6e |
QLabel *m_yPosLabel;
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
d5045c |
QComboBox *m_displayModeCombo;
|
|
shun-iwasawa |
d5045c |
|
|
shun-iwasawa |
d5045c |
bool m_showCompare;
|
|
shun-iwasawa |
d5045c |
bool m_compHistoIsValid;
|
|
shun-iwasawa |
d5045c |
int m_channelValueComp[4][COMBOHIST_RESOLUTION_W];
|
|
shun-iwasawa |
d5045c |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ComboHistogram(QWidget *parent = 0);
|
|
Shinya Kitaoka |
120a6e |
~ComboHistogram();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TRasterP getRaster() const { return m_raster; }
|
|
Shinya Kitaoka |
120a6e |
void setRaster(const TRasterP &raster, const TPaletteP &palette = 0);
|
|
Shinya Kitaoka |
120a6e |
void updateInfo(const TPixel32 &pix, const TPointD &imagePos);
|
|
shun-iwasawa |
d5045c |
void updateInfo(const TPixel64 &pix, const TPointD &imagePos);
|
|
Shinya Kitaoka |
120a6e |
void updateAverageColor(const TPixel32 &pix);
|
|
shun-iwasawa |
d5045c |
void updateAverageColor(const TPixel64 &pix);
|
|
shun-iwasawa |
d5045c |
void updateCompHistogram();
|
|
shun-iwasawa |
d5045c |
|
|
shun-iwasawa |
d5045c |
void setShowCompare(bool on) {
|
|
shun-iwasawa |
d5045c |
m_showCompare = on;
|
|
shun-iwasawa |
d5045c |
if (isVisible() && !m_compHistoIsValid) updateCompHistogram();
|
|
shun-iwasawa |
d5045c |
}
|
|
shun-iwasawa |
d5045c |
void invalidateCompHisto() {
|
|
shun-iwasawa |
d5045c |
m_compHistoIsValid = false;
|
|
shun-iwasawa |
d5045c |
if (isVisible() && m_showCompare) updateCompHistogram();
|
|
shun-iwasawa |
d5045c |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
shun-iwasawa |
d5045c |
void computeChannelsValue(int *buf, size_t size, TRasterP ras,
|
|
shun-iwasawa |
d5045c |
TPalette *extPlt = nullptr);
|
|
shun-iwasawa |
d5045c |
void showEvent(QShowEvent *) override;
|
|
shun-iwasawa |
d5045c |
|
|
shun-iwasawa |
d5045c |
protected slots:
|
|
shun-iwasawa |
d5045c |
void onDisplayModeChanged();
|
|
shun-iwasawa |
2cda63 |
void onShowAlphaButtonToggled(bool);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|