shun-iwasawa 021eef
#pragma once
shun-iwasawa 021eef
shun-iwasawa 021eef
/*------------
shun-iwasawa 021eef
 Iwa_BloomFx
shun-iwasawa 021eef
 Based on the LightBloom plugin fx by Dwango, with modifications as follows:
shun-iwasawa 021eef
 - parameters are reduced & simplified to gamma, gain and size
shun-iwasawa 021eef
 - reduced the block noise appeared especially when the gamma is with higher
shun-iwasawa 021eef
value
shun-iwasawa 021eef
 - enabled to render alpha gradation
shun-iwasawa 021eef
 - enabled to adjust size with the viewer gadget
shun-iwasawa 021eef
--------------*/
shun-iwasawa 021eef
shun-iwasawa 021eef
#ifndef IWA_BLOOMFX_H
shun-iwasawa 021eef
#define IWA_BLOOMFX_H
shun-iwasawa 021eef
shun-iwasawa 021eef
#include "stdfx.h"
shun-iwasawa 021eef
#include "tfxparam.h"
shun-iwasawa 021eef
#include <opencv2 opencv.hpp=""></opencv2>
shun-iwasawa 021eef
shun-iwasawa 021eef
class Iwa_BloomFx : public TStandardRasterFx {
shun-iwasawa 021eef
  FX_PLUGIN_DECLARATION(Iwa_BloomFx)
shun-iwasawa 021eef
protected:
shun-iwasawa 021eef
  TRasterFxPort m_source;
shun-iwasawa 021eef
  TDoubleParamP m_gamma;
shun-iwasawa 021eef
  TDoubleParamP m_gain;
shun-iwasawa 021eef
  TDoubleParamP m_size;
shun-iwasawa 021eef
  TBoolParamP m_alpha_rendering;
shun-iwasawa 021eef
shun-iwasawa 021eef
  double getSizePixelAmount(const double val, const TAffine affine);
shun-iwasawa 021eef
  template <typename pixel="" raster,="" typename=""></typename>
shun-iwasawa 021eef
  void setSourceTileToMat(const RASTER ras, cv::Mat &ingMat,
shun-iwasawa 021eef
                          const double gamma);
shun-iwasawa 021eef
shun-iwasawa 021eef
  template <typename pixel="" raster,="" typename=""></typename>
shun-iwasawa 021eef
  void setMatToOutput(const RASTER ras, const RASTER srcRas, cv::Mat &ingMat,
shun-iwasawa 021eef
                      const double gamma, const double gain,
shun-iwasawa 021eef
                      const bool withAlpha, const int margin);
shun-iwasawa 021eef
shun-iwasawa 021eef
public:
shun-iwasawa 021eef
  Iwa_BloomFx();
shun-iwasawa 021eef
  void doCompute(TTile &tile, double frame,
shun-iwasawa 021eef
                 const TRenderSettings &settings) override;
shun-iwasawa 021eef
  bool doGetBBox(double frame, TRectD &bBox,
shun-iwasawa 021eef
                 const TRenderSettings &info) override;
shun-iwasawa 021eef
  bool canHandle(const TRenderSettings &info, double frame) override;
shun-iwasawa 021eef
  void getParamUIs(TParamUIConcept *&concepts, int &length) override;
shun-iwasawa 021eef
};
shun-iwasawa 021eef
shun-iwasawa 021eef
#endif