|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "trop.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tfxparam.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "texception.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "stdfx.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class RGBMScaleFx : public TStandardRasterFx
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
FX_PLUGIN_DECLARATION(RGBMScaleFx)
|
|
Toshihiro Shimizu |
890ddd |
TRasterFxPort m_input;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_red;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_green;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_blue;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_matte;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
RGBMScaleFx()
|
|
Toshihiro Shimizu |
890ddd |
: m_red(100.0), m_green(100.0), m_blue(100.0), m_matte(100.0)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "red", m_red);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "green", m_green);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "blue", m_blue);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "matte", m_matte);
|
|
Toshihiro Shimizu |
890ddd |
m_red->setValueRange(0, (std::numeric_limits<double>::max)());</double>
|
|
Toshihiro Shimizu |
890ddd |
m_green->setValueRange(0, (std::numeric_limits<double>::max)());</double>
|
|
Toshihiro Shimizu |
890ddd |
m_blue->setValueRange(0, (std::numeric_limits<double>::max)());</double>
|
|
Toshihiro Shimizu |
890ddd |
m_matte->setValueRange(0, (std::numeric_limits<double>::max)());</double>
|
|
Toshihiro Shimizu |
890ddd |
addInputPort("Source", m_input);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
~RGBMScaleFx(){};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool doGetBBox(double frame, TRectD &bBox, const TRenderSettings &info)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_input.isConnected())
|
|
Toshihiro Shimizu |
890ddd |
return m_input->doGetBBox(frame, bBox, info);
|
|
Toshihiro Shimizu |
890ddd |
else {
|
|
Toshihiro Shimizu |
890ddd |
bBox = TRectD();
|
|
Toshihiro Shimizu |
890ddd |
return false;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void doCompute(TTile &tile, double frame, const TRenderSettings &ri);
|
|
Toshihiro Shimizu |
890ddd |
bool canHandle(const TRenderSettings &info, double frame) { return true; }
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void RGBMScaleFx::doCompute(TTile &tile, double frame,
|
|
Toshihiro Shimizu |
890ddd |
const TRenderSettings &ri)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!m_input.isConnected())
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
m_input->compute(tile, frame, ri);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
double red = m_red->getValue(frame) / 100;
|
|
Toshihiro Shimizu |
890ddd |
double green = m_green->getValue(frame) / 100;
|
|
Toshihiro Shimizu |
890ddd |
double blue = m_blue->getValue(frame) / 100;
|
|
Toshihiro Shimizu |
890ddd |
double matte = m_matte->getValue(frame) / 100;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//TRaster32P raster32 = tile.getRaster();
|
|
Toshihiro Shimizu |
890ddd |
//assert(raster32); // per ora gestisco solo i Raster32
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TRop::rgbmScale(tile.getRaster(), tile.getRaster(), red, green, blue, matte);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
FX_PLUGIN_IDENTIFIER(RGBMScaleFx, "rgbmScaleFx");
|