Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "stdfx.h"
Toshihiro Shimizu 890ddd
//#include "tfxparam.h"
Toshihiro Shimizu 890ddd
#include "trop.h"
Toshihiro Shimizu 890ddd
//===================================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class PremultiplyFx : public TStandardRasterFx {
Shinya Kitaoka 120a6e
  FX_PLUGIN_DECLARATION(PremultiplyFx)
Shinya Kitaoka 120a6e
  TRasterFxPort m_input;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  PremultiplyFx() { addInputPort("Source", m_input); }
Shinya Kitaoka 120a6e
  ~PremultiplyFx(){};
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  bool doGetBBox(double frame, TRectD &bBox, 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 473e70
  bool canHandle(const TRenderSettings &info, double frame) override { return true; }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void PremultiplyFx::doCompute(TTile &tile, double frame,
Shinya Kitaoka 120a6e
                              const TRenderSettings &ri) {
Shinya Kitaoka 120a6e
  if (!m_input.isConnected()) return;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  m_input->compute(tile, frame, ri);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TRop::premultiply(tile.getRaster());
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
FX_PLUGIN_IDENTIFIER(PremultiplyFx, "premultiplyFx");