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 {
Shinya Kitaoka 120a6e
  QColor m_color;
Toshihiro Shimizu 890ddd
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);
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
Shinya Kitaoka 120a6e
  QVector<int> m_values;</int>
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int m_pickedValue;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  int *m_channelValuePtr;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ChannelHistoGraph(QWidget *parent = 0, int *channelValue = 0);
Shinya Kitaoka 120a6e
  ~ChannelHistoGraph();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual void setValues();
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:
Shinya Kitaoka 120a6e
  RGBHistoGraph(QWidget *parent = 0, int *channelValue = 0);
Shinya Kitaoka 120a6e
  ~RGBHistoGraph();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void setValues() 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:
Shinya Kitaoka 120a6e
  ChannelHisto(int channelIndex, int *channelValue, QWidget *parent = 0);
Shinya Kitaoka 120a6e
  ~ChannelHisto() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void refleshValue() { m_histogramGraph->setValues(); }
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);
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
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);
Shinya Kitaoka 120a6e
  void updateAverageColor(const TPixel32 &pix);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  void computeChannelsValue();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif