|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Shinya Kitaoka |
810553 |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef ino_common_h
|
|
Toshihiro Shimizu |
890ddd |
#define ino_common_h
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "trop.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "trasterfx.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "stdfx.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace ino {
|
|
Toshihiro Shimizu |
890ddd |
/* 一時バッファとの変換機能 */
|
|
Shinya Kitaoka |
120a6e |
void ras_to_arr(const TRasterP in_ras, const int channels,
|
|
shun-iwasawa |
e00258 |
unsigned char* out_arr);
|
|
shun-iwasawa |
e00258 |
void arr_to_ras(const unsigned char* in_arr, const int channels,
|
|
Shinya Kitaoka |
120a6e |
TRasterP out_ras, const int margin);
|
|
Shinya Kitaoka |
120a6e |
void ras_to_vec(const TRasterP ras, const int channels,
|
|
shun-iwasawa |
e00258 |
std::vector<unsigned char="">& vec);</unsigned>
|
|
shun-iwasawa |
e00258 |
void vec_to_ras(std::vector<unsigned char="">& vec, const int channels,</unsigned>
|
|
Shinya Kitaoka |
120a6e |
TRasterP ras, const int margin = 0);
|
|
Toshihiro Shimizu |
890ddd |
// void Lx_to_wrap( TRasterP ras );
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* logのserverアクセスON/OFF,install時設定をするための機能 */
|
|
Toshihiro Shimizu |
890ddd |
/* TEnv::getConfigDir() + "fx_ino_no_log.setup"
|
|
Shinya Kitaoka |
120a6e |
が存在するとtrueを返す */
|
|
Toshihiro Shimizu |
890ddd |
bool log_enable_sw(void);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* toonz6.0.x専用の固定値を返すinline(埋め込み)関数 */
|
|
Shinya Kitaoka |
120a6e |
inline double param_range(void) { return 1.0; } // 1 or 100%
|
|
Shinya Kitaoka |
120a6e |
inline int channels(void) { return 4; } // RGBM is 4 channels
|
|
Shinya Kitaoka |
120a6e |
inline int bits(const TRasterP ras) {
|
|
Shinya Kitaoka |
120a6e |
return ((TRaster64P)ras) ? (std::numeric_limits<unsigned short="">::digits)</unsigned>
|
|
Shinya Kitaoka |
120a6e |
: (std::numeric_limits<unsigned char="">::digits);</unsigned>
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Shinya Kitaoka |
120a6e |
inline int pixel_bits(const TRasterP ras) {
|
|
Shinya Kitaoka |
120a6e |
return ino::channels() * ino::bits(ras);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Shinya Kitaoka |
120a6e |
// inline double pixel_per_mm(void) { return 640. / 12. / 25.4; }
|
|
Toshihiro Shimizu |
890ddd |
inline double pixel_per_mm(void) { return 1.; }
|
|
Toshihiro Shimizu |
890ddd |
// inline double pixel_per_inch(void) { return 640. / 12.; }
|
|
shun-iwasawa |
e00258 |
} // namespace ino
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class TBlendForeBackRasterFx : public TRasterFx {
|
|
shun-iwasawa |
e00258 |
protected:
|
|
shun-iwasawa |
e00258 |
TRasterFxPort m_up;
|
|
shun-iwasawa |
e00258 |
TRasterFxPort m_down;
|
|
shun-iwasawa |
e00258 |
TDoubleParamP m_opacity;
|
|
shun-iwasawa |
e00258 |
TBoolParamP m_clipping_mask;
|
|
shun-iwasawa |
e00258 |
|
|
shun-iwasawa |
e00258 |
TBoolParamP m_linear;
|
|
shun-iwasawa |
e00258 |
TDoubleParamP m_gamma;
|
|
shun-iwasawa |
e00258 |
|
|
shun-iwasawa |
e00258 |
// If the pixel is premultiplied, divide color data by the alpha before
|
|
shun-iwasawa |
e00258 |
// converting from the colorspace, and then multiply by the alpha afterwards.
|
|
shun-iwasawa |
e00258 |
// This will correct the color of the semi-transparent pixels in most cases.
|
|
shun-iwasawa |
e00258 |
TBoolParamP m_premultiplied;
|
|
shun-iwasawa |
e00258 |
|
|
shun-iwasawa |
e00258 |
TBoolParamP m_alpha_rendering; // optional
|
|
shun-iwasawa |
e00258 |
|
|
shun-iwasawa |
e00258 |
void dryComputeUpAndDown(TRectD& rect, double frame,
|
|
shun-iwasawa |
26a3ce |
const TRenderSettings& rs,
|
|
shun-iwasawa |
26a3ce |
bool upComputesWholeTile = false);
|
|
shun-iwasawa |
e00258 |
|
|
shun-iwasawa |
e00258 |
void doComputeFx(TRasterP& dn_ras_out, const TRasterP& up_ras,
|
|
shun-iwasawa |
26a3ce |
const TPoint& pos, const double up_opacity,
|
|
shun-iwasawa |
26a3ce |
const double gamma);
|
|
shun-iwasawa |
e00258 |
|
|
shun-iwasawa |
e00258 |
template <class class="" q="" t,=""></class>
|
|
shun-iwasawa |
e00258 |
void nonlinearTmpl(TRasterPT<t> dn_ras_out, const TRasterPT<t>& up_ras,</t></t>
|
|
shun-iwasawa |
26a3ce |
const double up_opacity);
|
|
shun-iwasawa |
e00258 |
|
|
shun-iwasawa |
e00258 |
template <class class="" q="" t,=""></class>
|
|
shun-iwasawa |
e00258 |
void linearTmpl(TRasterPT<t> dn_ras_out, const TRasterPT<t>& up_ras,</t></t>
|
|
shun-iwasawa |
26a3ce |
const double up_opacity, const double gamma);
|
|
shun-iwasawa |
e00258 |
|
|
shun-iwasawa |
26a3ce |
// when compute in xyz color space, do not clamp channel values in the kernel
|
|
shun-iwasawa |
e00258 |
virtual void brendKernel(double& dnr, double& dng, double& dnb, double& dna,
|
|
shun-iwasawa |
26a3ce |
const double up_, double upg, double upb, double upa,
|
|
shun-iwasawa |
26a3ce |
const double upopacity,
|
|
shun-iwasawa |
26a3ce |
const bool alpha_rendering_sw = true,
|
|
shun-iwasawa |
26a3ce |
const bool is_xyz = false) = 0;
|
|
shun-iwasawa |
e00258 |
|
|
shun-iwasawa |
e00258 |
void computeUpAndDown(TTile& tile, double frame, const TRenderSettings& rs,
|
|
shun-iwasawa |
26a3ce |
TRasterP& dn_ras, TRasterP& up_ras,
|
|
shun-iwasawa |
26a3ce |
bool upComputesWholeTile = false);
|
|
shun-iwasawa |
e00258 |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
shun-iwasawa |
e00258 |
TBlendForeBackRasterFx(bool clipping_mask, bool has_alpha_option = false);
|
|
shun-iwasawa |
e00258 |
|
|
shun-iwasawa |
e00258 |
bool canHandle(const TRenderSettings& rs, double frame) override {
|
|
shun-iwasawa |
e00258 |
return true;
|
|
shun-iwasawa |
e00258 |
}
|
|
shun-iwasawa |
e00258 |
bool doGetBBox(double frame, TRectD& bBox,
|
|
shun-iwasawa |
e00258 |
const TRenderSettings& rs) override;
|
|
shun-iwasawa |
e00258 |
int getMemoryRequirement(const TRectD& rect, double frame,
|
|
shun-iwasawa |
e00258 |
const TRenderSettings& rs) override {
|
|
shun-iwasawa |
e00258 |
return TRasterFx::memorySize(rect, rs.m_bpp);
|
|
shun-iwasawa |
e00258 |
}
|
|
shun-iwasawa |
e00258 |
void doDryCompute(TRectD& rect, double frame,
|
|
shun-iwasawa |
e00258 |
const TRenderSettings& rs) override {
|
|
shun-iwasawa |
e00258 |
this->dryComputeUpAndDown(rect, frame, rs, false);
|
|
shun-iwasawa |
e00258 |
}
|
|
shun-iwasawa |
e00258 |
|
|
shun-iwasawa |
e00258 |
void doCompute(TTile& tile, double frame, const TRenderSettings& rs) override;
|
|
shun-iwasawa |
e00258 |
|
|
Shinya Kitaoka |
120a6e |
/* FX nodeが無効のときの、表示port番号 */
|
|
Shinya Kitaoka |
473e70 |
int getPreferredInputPort() override { return 1; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
std::string getPluginId() const override { return PLUGIN_PREFIX; }
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif /* !ino_common_h */
|