|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tpixelutils.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tvectorimage.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "trop.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include <qapplication></qapplication>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/cleanupcolorstyles.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TCleanupStyle::TCleanupStyle(const TPixel32 &color)
|
|
Shinya Kitaoka |
120a6e |
: TSolidColorStyle(color)
|
|
Shinya Kitaoka |
120a6e |
, m_outColor(color)
|
|
Shinya Kitaoka |
120a6e |
, m_brightness(0)
|
|
Shinya Kitaoka |
120a6e |
, m_contrast(50)
|
|
Shinya Kitaoka |
120a6e |
, m_canUpdate(true) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TCleanupStyle::TCleanupStyle(const TCleanupStyle &src)
|
|
Shinya Kitaoka |
120a6e |
: TSolidColorStyle(src)
|
|
Shinya Kitaoka |
120a6e |
, m_outColor(src.m_outColor)
|
|
Shinya Kitaoka |
120a6e |
, m_brightness(src.m_brightness)
|
|
Shinya Kitaoka |
120a6e |
, m_contrast(src.m_contrast)
|
|
Shinya Kitaoka |
120a6e |
, m_contrastEnable(true)
|
|
Shinya Kitaoka |
120a6e |
, m_canUpdate(src.m_canUpdate) {
|
|
Shinya Kitaoka |
120a6e |
setName(src.getName());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TCleanupStyle::~TCleanupStyle() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TCleanupStyle::setCanUpdate(bool state) { m_canUpdate = state; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TCleanupStyle::loadData(TInputStreamInterface &is) {
|
|
Shinya Kitaoka |
120a6e |
TSolidColorStyle::loadData(is);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
VersionNumber version(is.versionNumber());
|
|
Shinya Kitaoka |
120a6e |
if (version.first == 1 && version.second == 18) {
|
|
Shinya Kitaoka |
120a6e |
// Toonz 6.3 ML had removed the output color option
|
|
Shinya Kitaoka |
120a6e |
TPixel32 dummy;
|
|
Shinya Kitaoka |
120a6e |
is >> dummy >> m_brightness >> m_contrast;
|
|
Shinya Kitaoka |
120a6e |
m_outColor = getMainColor();
|
|
Shinya Kitaoka |
120a6e |
} else
|
|
Shinya Kitaoka |
120a6e |
is >> m_outColor >> m_brightness >> m_contrast;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TCleanupStyle::saveData(TOutputStreamInterface &os) const {
|
|
Shinya Kitaoka |
120a6e |
TSolidColorStyle::saveData(os);
|
|
Shinya Kitaoka |
120a6e |
os << m_outColor << m_brightness << m_contrast;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TCleanupStyle::setMainColor(const TPixel32 &color) {
|
|
Shinya Kitaoka |
120a6e |
if (getMainColor() == m_outColor) m_outColor = color;
|
|
Shinya Kitaoka |
120a6e |
TSolidColorStyle::setMainColor(color);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int TCleanupStyle::getColorParamCount() const { return 2; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPixel32 TCleanupStyle::getColorParamValue(int index) const {
|
|
Shinya Kitaoka |
120a6e |
return (index == 0) ? getMainColor() : m_outColor;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TCleanupStyle::setColorParamValue(int index, const TPixel32 &color) {
|
|
Shinya Kitaoka |
120a6e |
if (index == 0)
|
|
Shinya Kitaoka |
120a6e |
setMainColor(color);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
m_outColor = color;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QString TCleanupStyle::getParamNames(int index) const {
|
|
Shinya Kitaoka |
120a6e |
switch (index) {
|
|
Shinya Kitaoka |
120a6e |
case 0:
|
|
Yu Chen |
da5534 |
return QObject::tr("Brightness");
|
|
Shinya Kitaoka |
120a6e |
case 1:
|
|
Yu Chen |
da5534 |
return QObject::tr("Contrast");
|
|
Shinya Kitaoka |
120a6e |
default:
|
|
Shinya Kitaoka |
120a6e |
return QString("");
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TCleanupStyle::getParamRange(int index, double &min, double &max) const {
|
|
Shinya Kitaoka |
120a6e |
if (index == 0) {
|
|
Shinya Kitaoka |
120a6e |
min = -100;
|
|
Shinya Kitaoka |
120a6e |
max = 100;
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
min = 0;
|
|
Shinya Kitaoka |
120a6e |
max = 100;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
double TCleanupStyle::getParamValue(TColorStyle::double_tag, int index) const {
|
|
Shinya Kitaoka |
120a6e |
switch (index) {
|
|
Shinya Kitaoka |
120a6e |
case 0:
|
|
Shinya Kitaoka |
120a6e |
return getBrightness();
|
|
Shinya Kitaoka |
120a6e |
case 1:
|
|
Shinya Kitaoka |
120a6e |
return getContrast();
|
|
Shinya Kitaoka |
120a6e |
default:
|
|
Shinya Kitaoka |
120a6e |
return 0.0;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TCleanupStyle::setParamValue(int index, double value) {
|
|
Shinya Kitaoka |
120a6e |
switch (index) {
|
|
Shinya Kitaoka |
120a6e |
case 0:
|
|
Shinya Kitaoka |
120a6e |
setBrightness(value);
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
case 1:
|
|
Shinya Kitaoka |
120a6e |
setContrast(value);
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TCleanupStyle::setBrightness(double b) { m_brightness = b; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TCleanupStyle::setContrast(double c) { m_contrast = c; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TCleanupStyle::enableContrast(bool value) { m_contrastEnable = value; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool TCleanupStyle::isContrastEnabled() const { return m_contrastEnable; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TCleanupStyle::makeIcon(const TDimension &size) {
|
|
Shinya Kitaoka |
120a6e |
// Build an icon with mainColor on the top half, and
|
|
Shinya Kitaoka |
120a6e |
// getColorParamValue(1) on the bottom.
|
|
Shinya Kitaoka |
120a6e |
if (!m_icon || m_icon->getSize() != size) {
|
|
Shinya Kitaoka |
120a6e |
TRaster32P ras(size);
|
|
Shinya Kitaoka |
120a6e |
m_icon = ras;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPixel32 topCol(getMainColor()), botCol(getColorParamValue(1));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int ly_2 = size.ly / 2;
|
|
Shinya Kitaoka |
120a6e |
TRaster32P botRas(m_icon->extract(0, 0, size.lx, ly_2));
|
|
Shinya Kitaoka |
120a6e |
TRaster32P topRas(m_icon->extract(0, ly_2 + 1, size.lx, size.ly));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
makeIcon(botRas, botCol);
|
|
Shinya Kitaoka |
120a6e |
makeIcon(topRas, topCol);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TCleanupStyle::makeIcon(TRaster32P &ras, const TPixel32 &col) {
|
|
Shinya Kitaoka |
120a6e |
if (col.m == 255)
|
|
Shinya Kitaoka |
120a6e |
ras->fill(col);
|
|
Shinya Kitaoka |
120a6e |
else {
|
|
Shinya Kitaoka |
120a6e |
TRaster32P fg(ras->getSize());
|
|
Shinya Kitaoka |
120a6e |
fg->fill(premultiply(col));
|
|
Shinya Kitaoka |
120a6e |
TRop::checkBoard(ras, TPixel32::Black, TPixel32::White, TDimensionD(6, 6),
|
|
Shinya Kitaoka |
120a6e |
TPointD());
|
|
Shinya Kitaoka |
120a6e |
TRop::over(ras, fg);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TColorCleanupStyle::TColorCleanupStyle(const TPixel32 &color)
|
|
Shinya Kitaoka |
120a6e |
: TCleanupStyle(color), m_hRange(60.0), m_lineWidth(90.0) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TColorCleanupStyle::loadData(TInputStreamInterface &is) {
|
|
Shinya Kitaoka |
120a6e |
TCleanupStyle::loadData(is);
|
|
Shinya Kitaoka |
120a6e |
is >> m_hRange;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (is.versionNumber() >= VersionNumber(1, 18)) is >> m_lineWidth;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TColorCleanupStyle::saveData(TOutputStreamInterface &os) const {
|
|
Shinya Kitaoka |
120a6e |
TCleanupStyle::saveData(os);
|
|
Shinya Kitaoka |
120a6e |
os << m_hRange;
|
|
Shinya Kitaoka |
120a6e |
os << m_lineWidth;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TColorStyle *TColorCleanupStyle::clone() const {
|
|
Shinya Kitaoka |
120a6e |
return new TColorCleanupStyle(*this);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QString TColorCleanupStyle::getDescription() const { return "CleanupColor"; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int TColorCleanupStyle::getTagId() const { return 2001; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QString TColorCleanupStyle::getParamNames(int index) const {
|
|
Yu Chen |
da5534 |
if (index == 2) QObject::tr("HRange");
|
|
Yu Chen |
da5534 |
if (index == 3) QObject::tr("Line Width");
|
|
Shinya Kitaoka |
120a6e |
return TCleanupStyle::getParamNames(index);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TColorCleanupStyle::getParamRange(int index, double &min,
|
|
Shinya Kitaoka |
120a6e |
double &max) const {
|
|
Shinya Kitaoka |
120a6e |
if (index >= 2) {
|
|
Shinya Kitaoka |
120a6e |
min = 0;
|
|
Shinya Kitaoka |
120a6e |
max = 100;
|
|
Shinya Kitaoka |
120a6e |
} else
|
|
Shinya Kitaoka |
120a6e |
TCleanupStyle::getParamRange(index, min, max);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
double TColorCleanupStyle::getParamValue(TColorStyle::double_tag tag,
|
|
Shinya Kitaoka |
120a6e |
int index) const {
|
|
Shinya Kitaoka |
120a6e |
if (index == 2) return getHRange();
|
|
Shinya Kitaoka |
120a6e |
if (index == 3) return getLineWidth();
|
|
Shinya Kitaoka |
120a6e |
return TCleanupStyle::getParamValue(tag, index);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TColorCleanupStyle::setParamValue(int index, double value) {
|
|
Shinya Kitaoka |
120a6e |
if (index == 2)
|
|
Shinya Kitaoka |
120a6e |
setHRange(value);
|
|
Shinya Kitaoka |
120a6e |
else if (index == 3)
|
|
Shinya Kitaoka |
120a6e |
setLineWidth(value);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
TCleanupStyle::setParamValue(index, value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TColorCleanupStyle::setHRange(double hRange) { m_hRange = hRange; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TColorCleanupStyle::setLineWidth(double lineWidth) {
|
|
Shinya Kitaoka |
120a6e |
m_lineWidth = lineWidth;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TBlackCleanupStyle::TBlackCleanupStyle(const TPixel32 &color)
|
|
Shinya Kitaoka |
120a6e |
: TCleanupStyle(color), m_colorThreshold(70), m_whiteThreshold(10) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TColorStyle *TBlackCleanupStyle::clone() const {
|
|
Shinya Kitaoka |
120a6e |
return new TBlackCleanupStyle(*this);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TBlackCleanupStyle::loadData(TInputStreamInterface &is) {
|
|
Shinya Kitaoka |
120a6e |
TCleanupStyle::loadData(is);
|
|
Shinya Kitaoka |
120a6e |
is >> m_colorThreshold >> m_whiteThreshold;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TBlackCleanupStyle::saveData(TOutputStreamInterface &os) const {
|
|
Shinya Kitaoka |
120a6e |
TCleanupStyle::saveData(os);
|
|
Shinya Kitaoka |
120a6e |
os << m_colorThreshold << m_whiteThreshold;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QString TBlackCleanupStyle::getDescription() const { return "CleanupBlack"; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int TBlackCleanupStyle::getTagId() const { return 2002; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QString TBlackCleanupStyle::getParamNames(int index) const {
|
|
Shinya Kitaoka |
120a6e |
switch (index) {
|
|
Shinya Kitaoka |
120a6e |
case 2:
|
|
Yu Chen |
da5534 |
return QObject::tr("ColorThres");
|
|
Shinya Kitaoka |
120a6e |
case 3:
|
|
Yu Chen |
da5534 |
return QObject::tr("WhiteThres");
|
|
Shinya Kitaoka |
120a6e |
default:
|
|
Shinya Kitaoka |
120a6e |
return TCleanupStyle::getParamNames(index);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TBlackCleanupStyle::getParamRange(int index, double &min,
|
|
Shinya Kitaoka |
120a6e |
double &max) const {
|
|
Shinya Kitaoka |
120a6e |
switch (index) {
|
|
Shinya Kitaoka |
120a6e |
case 2:
|
|
Shinya Kitaoka |
120a6e |
case 3:
|
|
Shinya Kitaoka |
120a6e |
min = 0;
|
|
Shinya Kitaoka |
120a6e |
max = 100;
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
default:
|
|
Shinya Kitaoka |
120a6e |
TCleanupStyle::getParamRange(index, min, max);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
double TBlackCleanupStyle::getParamValue(TColorStyle::double_tag tag,
|
|
Shinya Kitaoka |
120a6e |
int index) const {
|
|
Shinya Kitaoka |
120a6e |
switch (index) {
|
|
Shinya Kitaoka |
120a6e |
case 2:
|
|
Shinya Kitaoka |
120a6e |
return getColorThreshold();
|
|
Shinya Kitaoka |
120a6e |
case 3:
|
|
Shinya Kitaoka |
120a6e |
return getWhiteThreshold();
|
|
Shinya Kitaoka |
120a6e |
default:
|
|
Shinya Kitaoka |
120a6e |
return TCleanupStyle::getParamValue(tag, index);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TBlackCleanupStyle::setParamValue(int index, double value) {
|
|
Shinya Kitaoka |
120a6e |
switch (index) {
|
|
Shinya Kitaoka |
120a6e |
case 2:
|
|
Shinya Kitaoka |
120a6e |
setColorThreshold(value);
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
case 3:
|
|
Shinya Kitaoka |
120a6e |
setWhiteThreshold(value);
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
default:
|
|
Shinya Kitaoka |
120a6e |
TCleanupStyle::setParamValue(index, value);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TBlackCleanupStyle::setColorThreshold(double threshold) {
|
|
Shinya Kitaoka |
120a6e |
m_colorThreshold = threshold;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TBlackCleanupStyle::setWhiteThreshold(double threshold) {
|
|
Shinya Kitaoka |
120a6e |
m_whiteThreshold = threshold;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace {
|
|
Toshihiro Shimizu |
890ddd |
TColorStyle::Declaration s0(new TBlackCleanupStyle());
|
|
Toshihiro Shimizu |
890ddd |
TColorStyle::Declaration s1(new TColorCleanupStyle());
|
|
Toshihiro Shimizu |
890ddd |
}
|