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