|
Toshihiro Shimizu |
890ddd |
#include <sstream> /* std::ostringstream */</sstream>
|
|
Toshihiro Shimizu |
890ddd |
#include "tfxparam.h"
|
|
Shinya Kitaoka |
120a6e |
#include "tparamset.h" // TPointParamP
|
|
Toshihiro Shimizu |
890ddd |
#include "stdfx.h"
|
|
Shinya Kitaoka |
120a6e |
#include "tparamuiconcept.h" //add 20140130
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "ino_common.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "igs_radial_blur.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------
|
|
Shinya Kitaoka |
120a6e |
namespace {
|
|
Toshihiro Shimizu |
890ddd |
const double ino_param_range = 100.0;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Shinya Kitaoka |
d1f6c4 |
class ino_radial_blur final : public TStandardRasterFx {
|
|
Shinya Kitaoka |
120a6e |
FX_PLUGIN_DECLARATION(ino_radial_blur)
|
|
Shinya Kitaoka |
120a6e |
TRasterFxPort m_input;
|
|
Shinya Kitaoka |
120a6e |
TRasterFxPort m_refer;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPointParamP m_center;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_blur;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_radius;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_twist;
|
|
Shinya Kitaoka |
120a6e |
// TDoubleParamP m_twist_radius;
|
|
Shinya Kitaoka |
120a6e |
TBoolParamP m_alpha_rendering;
|
|
Shinya Kitaoka |
120a6e |
TBoolParamP m_anti_alias;
|
|
Shinya Kitaoka |
120a6e |
TIntEnumParamP m_ref_mode;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ino_radial_blur()
|
|
Shinya Kitaoka |
120a6e |
: m_center(TPointD(0.0, 0.0))
|
|
Shinya Kitaoka |
120a6e |
, m_blur(0.01 * ino_param_range)
|
|
Shinya Kitaoka |
120a6e |
, m_radius(0.0)
|
|
Shinya Kitaoka |
120a6e |
, m_twist(0.0)
|
|
Shinya Kitaoka |
120a6e |
// ,m_twist_radius(0.0)
|
|
Shinya Kitaoka |
120a6e |
, m_alpha_rendering(true)
|
|
Shinya Kitaoka |
120a6e |
, m_anti_alias(false)
|
|
Shinya Kitaoka |
120a6e |
, m_ref_mode(new TIntEnumParam(0, "Red")) {
|
|
Shinya Kitaoka |
120a6e |
this->m_center->getX()->setMeasureName("fxLength");
|
|
Shinya Kitaoka |
120a6e |
this->m_center->getY()->setMeasureName("fxLength");
|
|
Shinya Kitaoka |
120a6e |
this->m_radius->setMeasureName("fxLength");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
addInputPort("Source", this->m_input);
|
|
Shinya Kitaoka |
120a6e |
addInputPort("Reference", this->m_refer);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "center", this->m_center);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "blur", this->m_blur);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "radius", this->m_radius);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "twist", this->m_twist);
|
|
Shinya Kitaoka |
120a6e |
// bindParam(this,"twist_radius", this->m_twist_radius);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "alpha_rendering", this->m_alpha_rendering);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "anti_alias", this->m_anti_alias);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "reference", this->m_ref_mode);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
this->m_radius->setValueRange(0, (std::numeric_limits<double>::max)());</double>
|
|
Shinya Kitaoka |
120a6e |
/* 拡大のしすぎを防ぐためにMaxを制限する */
|
|
Shinya Kitaoka |
120a6e |
this->m_blur->setValueRange(0.0 * ino_param_range, 1.0 * ino_param_range);
|
|
Shinya Kitaoka |
120a6e |
this->m_twist->setValueRange(-180.0, 180.0);
|
|
Shinya Kitaoka |
120a6e |
// this->m_twist_radius->setValueRange(0.0,1000.0);
|
|
Shinya Kitaoka |
120a6e |
this->m_ref_mode->addItem(1, "Green");
|
|
Shinya Kitaoka |
120a6e |
this->m_ref_mode->addItem(2, "Blue");
|
|
Shinya Kitaoka |
120a6e |
this->m_ref_mode->addItem(3, "Alpha");
|
|
Shinya Kitaoka |
120a6e |
this->m_ref_mode->addItem(4, "Luminance");
|
|
Shinya Kitaoka |
120a6e |
this->m_ref_mode->addItem(-1, "Nothing");
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
//------------------------------------------------------------
|
|
Shinya Kitaoka |
120a6e |
TPointD get_render_center(const double frame, const TPointD &pos,
|
|
Shinya Kitaoka |
120a6e |
const TAffine affine) {
|
|
Shinya Kitaoka |
120a6e |
/*--- 表示画像の中心をゼロとしたミリメートル単位の位置 ---*/
|
|
Shinya Kitaoka |
120a6e |
TPointD center = this->m_center->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
/*--- 単位変換(mm --> render用pixel) ---*/
|
|
Shinya Kitaoka |
120a6e |
center = center * ino::pixel_per_mm();
|
|
Shinya Kitaoka |
120a6e |
/*--- Affine変換(Geometry&Shrink&原点を中心から左下へ) ---*/
|
|
Shinya Kitaoka |
120a6e |
center = affine * center;
|
|
Shinya Kitaoka |
120a6e |
/*--- カメラ座標をrender画像座標の原点に ---*/
|
|
Shinya Kitaoka |
120a6e |
return center - pos;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
int get_render_int_margin(const double frame, const TRectD &bBox,
|
|
Shinya Kitaoka |
120a6e |
const TAffine affine, TPointD center) {
|
|
Shinya Kitaoka |
120a6e |
/*--- 単位変換(mm-->render用pixel)と長さ(scale)変換 ---*/
|
|
Shinya Kitaoka |
120a6e |
const double scale = ino::pixel_per_mm() * sqrt(fabs(affine.det()));
|
|
Shinya Kitaoka |
120a6e |
/*--- margin計算...Twist時正確でない ---*/
|
|
Shinya Kitaoka |
120a6e |
return igs::radial_blur::reference_margin(
|
|
Shinya Kitaoka |
120a6e |
static_cast<int>(ceil(bBox.getLy())),</int>
|
|
Shinya Kitaoka |
120a6e |
static_cast<int>(ceil(bBox.getLx())), center.x, center.y,</int>
|
|
Shinya Kitaoka |
120a6e |
this->m_twist->getValue(frame) * 3.14159265358979 / 180.0,
|
|
Shinya Kitaoka |
120a6e |
0.0 // this->m_twist_radius->getValue(frame) * scale
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
this->m_blur->getValue(frame) / ino_param_range
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//,this->m_radius->getValue(frame) * scale
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
0 /* debug:2012-02-01:ゼロ以上だとmarginが小さすぎになり画像が切れてしまう
|
|
Shinya Kitaoka |
120a6e |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
(this->m_anti_alias->getValue() ? 4 : 1));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
void get_render_enlarge(const double frame, const TAffine affine,
|
|
Shinya Kitaoka |
120a6e |
TRectD &bBox) {
|
|
Shinya Kitaoka |
120a6e |
TPointD center(this->get_render_center(frame, bBox.getP00(), affine));
|
|
Shinya Kitaoka |
120a6e |
int margin = this->get_render_int_margin(frame, bBox, affine, center);
|
|
Shinya Kitaoka |
120a6e |
if (0 < margin) {
|
|
Shinya Kitaoka |
120a6e |
/* 拡大のしすぎを防ぐテキトーな制限 */
|
|
Shinya Kitaoka |
120a6e |
if (4096 < margin) {
|
|
Shinya Kitaoka |
120a6e |
margin = 4096;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
bBox = bBox.enlarge(margin);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
//------------------------------------------------------------
|
|
Shinya Kitaoka |
38fd86 |
bool doGetBBox(double frame, TRectD &bBox,
|
|
Shinya Kitaoka |
38fd86 |
const TRenderSettings &info) override {
|
|
Shinya Kitaoka |
120a6e |
if (!this->m_input.isConnected()) {
|
|
Shinya Kitaoka |
120a6e |
bBox = TRectD();
|
|
Shinya Kitaoka |
120a6e |
return false;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
const bool ret = this->m_input->doGetBBox(frame, bBox, info);
|
|
Shinya Kitaoka |
120a6e |
this->get_render_enlarge(frame, info.m_affine, bBox);
|
|
Shinya Kitaoka |
120a6e |
return ret;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
int getMemoryRequirement(const TRectD &rect, double frame,
|
|
Shinya Kitaoka |
473e70 |
const TRenderSettings &info) override {
|
|
Shinya Kitaoka |
120a6e |
TRectD bBox(rect);
|
|
Shinya Kitaoka |
120a6e |
this->get_render_enlarge(frame, info.m_affine, bBox);
|
|
Shinya Kitaoka |
120a6e |
return TRasterFx::memorySize(bBox, info.m_bpp);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
void transform(double frame, int port, const TRectD &rectOnOutput,
|
|
Shinya Kitaoka |
120a6e |
const TRenderSettings &infoOnOutput, TRectD &rectOnInput,
|
|
Shinya Kitaoka |
473e70 |
TRenderSettings &infoOnInput) override {
|
|
Shinya Kitaoka |
120a6e |
rectOnInput = rectOnOutput;
|
|
Shinya Kitaoka |
120a6e |
infoOnInput = infoOnOutput;
|
|
Shinya Kitaoka |
120a6e |
this->get_render_enlarge(frame, infoOnOutput.m_affine, rectOnInput);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
473e70 |
bool canHandle(const TRenderSettings &info, double frame) override {
|
|
Shinya Kitaoka |
120a6e |
// return false; // toonz has geometry control
|
|
Shinya Kitaoka |
120a6e |
// return true;
|
|
Shinya Kitaoka |
120a6e |
/* 2012-11-14:
|
|
Shinya Kitaoka |
120a6e |
* trueのとき、Fx処理がジオメトリ変換の最後にまとめられてしまう。 */
|
|
Shinya Kitaoka |
120a6e |
return m_blur->getValue(frame) == 0 ? true
|
|
Shinya Kitaoka |
120a6e |
: isAlmostIsotropic(info.m_affine);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
473e70 |
void doCompute(TTile &tile, double frame, const TRenderSettings &ri) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// add 20140130
|
|
Shinya Kitaoka |
473e70 |
void getParamUIs(TParamUIConcept *&concepts, int &length) override {
|
|
Shinya Kitaoka |
120a6e |
concepts = new TParamUIConcept[length = 2];
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
concepts[0].m_type = TParamUIConcept::POINT;
|
|
Shinya Kitaoka |
120a6e |
concepts[0].m_label = "Center";
|
|
Shinya Kitaoka |
120a6e |
concepts[0].m_params.push_back(m_center);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
concepts[1].m_type = TParamUIConcept::RADIUS;
|
|
Shinya Kitaoka |
120a6e |
concepts[1].m_label = "Radius";
|
|
Shinya Kitaoka |
120a6e |
concepts[1].m_params.push_back(m_radius);
|
|
Shinya Kitaoka |
120a6e |
concepts[1].m_params.push_back(m_center);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
// add 20140130
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
FX_PLUGIN_IDENTIFIER(ino_radial_blur, "inoRadialBlurFx");
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------------
|
|
Shinya Kitaoka |
120a6e |
namespace {
|
|
Shinya Kitaoka |
120a6e |
void fx_(const TRasterP in_ras // with margin
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
const int margin
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
/* ここではinとrefは同サイズで使用している */
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
const TRasterP refer_ras // no margin
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
const int ref_mode
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
TRasterP out_ras // no margin
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
const double xp, const double yp, const double twist,
|
|
Shinya Kitaoka |
120a6e |
const double twist_radius, const double blur, const double radius,
|
|
Shinya Kitaoka |
120a6e |
const bool alpha_rendering_sw, const bool anti_alias_sw) {
|
|
Shinya Kitaoka |
120a6e |
TRasterGR8P in_gr8(in_ras->getLy(),
|
|
Shinya Kitaoka |
120a6e |
in_ras->getLx() * ino::channels() *
|
|
Shinya Kitaoka |
120a6e |
((TRaster64P)in_ras ? sizeof(unsigned short)
|
|
Shinya Kitaoka |
120a6e |
: sizeof(unsigned char)));
|
|
Shinya Kitaoka |
120a6e |
in_gr8->lock();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
igs::radial_blur::convert(
|
|
Shinya Kitaoka |
120a6e |
in_ras->getRawData() // BGRA
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
0 /* margin機能は使っていない、のでinとref画像は同サイズ */
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
(((0 <= ref_mode) && refer_ras) ? refer_ras->getRawData() : 0) // BGRA
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
(((0 <= ref_mode) && refer_ras) ? ino::bits(refer_ras) : 0), ref_mode
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
in_gr8->getRawData() // BGRA
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
in_ras->getLy(), in_ras->getLx(), ino::channels(), ino::bits(out_ras)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
xp + margin, yp + margin, twist, twist_radius, blur, radius
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
(anti_alias_sw ? 4 : 1), alpha_rendering_sw);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ino::arr_to_ras(in_gr8->getRawData(), ino::channels(), out_ras, margin);
|
|
Shinya Kitaoka |
120a6e |
in_gr8->unlock();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------
|
|
Shinya Kitaoka |
120a6e |
void ino_radial_blur::doCompute(TTile &tile, double frame,
|
|
Shinya Kitaoka |
120a6e |
const TRenderSettings &ri) {
|
|
Shinya Kitaoka |
120a6e |
/*------ 接続していなければ処理しない ----------------------*/
|
|
Shinya Kitaoka |
120a6e |
if (!this->m_input.isConnected()) {
|
|
Shinya Kitaoka |
120a6e |
tile.getRaster()->clear(); /* 塗りつぶしクリア */
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
/*------ サポートしていないPixelタイプはエラーを投げる -----*/
|
|
Shinya Kitaoka |
120a6e |
if (!((TRaster32P)tile.getRaster()) && !((TRaster64P)tile.getRaster())) {
|
|
Shinya Kitaoka |
120a6e |
throw TRopException("unsupported input pixel type");
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
/*------ パラメータを得る ----------------------------------*/
|
|
Shinya Kitaoka |
120a6e |
const double scale = ino::pixel_per_mm() * sqrt(fabs(ri.m_affine.det()));
|
|
Shinya Kitaoka |
120a6e |
const double blur = this->m_blur->getValue(frame) / ino_param_range;
|
|
Shinya Kitaoka |
120a6e |
const double radius = this->m_radius->getValue(frame) * scale;
|
|
Shinya Kitaoka |
120a6e |
const double twist =
|
|
Shinya Kitaoka |
120a6e |
this->m_twist->getValue(frame) * 3.14159265358979 / 180.0;
|
|
Shinya Kitaoka |
120a6e |
// const double twist_radius = this->m_twist_radius->getValue(frame)*scale;
|
|
Shinya Kitaoka |
120a6e |
const bool alpha_rend_sw = this->m_alpha_rendering->getValue();
|
|
Shinya Kitaoka |
120a6e |
const bool anti_alias_sw = this->m_anti_alias->getValue();
|
|
Shinya Kitaoka |
120a6e |
const int ref_mode = this->m_ref_mode->getValue();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPointD center = this->m_center->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
TPointD render_center(
|
|
Shinya Kitaoka |
120a6e |
this->get_render_center(frame, tile.m_pos, ri.m_affine));
|
|
Shinya Kitaoka |
120a6e |
/*------ 入力画像の範囲を得る ------------------------------*/
|
|
Shinya Kitaoka |
120a6e |
TRectD tile_with_margin =
|
|
Shinya Kitaoka |
120a6e |
TRectD(tile.m_pos /* Render画像上(Pixel単位)の位置 */
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
TDimensionD(/* Render画像上(Pixel単位)のサイズ */
|
|
Shinya Kitaoka |
120a6e |
tile.getRaster()->getLx(), tile.getRaster()->getLy()));
|
|
Shinya Kitaoka |
120a6e |
/*------ 入力画像のエリアの拡大 ----------------------------*/
|
|
Shinya Kitaoka |
120a6e |
int margin = this->get_render_int_margin(frame, tile_with_margin, ri.m_affine,
|
|
Shinya Kitaoka |
120a6e |
render_center);
|
|
Shinya Kitaoka |
120a6e |
if (0 < margin) {
|
|
Shinya Kitaoka |
120a6e |
/* 拡大のしすぎを防ぐテキトーな制限 */
|
|
Shinya Kitaoka |
120a6e |
if (4096 < margin) {
|
|
Shinya Kitaoka |
120a6e |
margin = 4096;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
tile_with_margin = tile_with_margin.enlarge(margin);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
/*------ 入力画像生成 --------------------------------------*/
|
|
Shinya Kitaoka |
120a6e |
TTile tile_allocated;
|
|
Shinya Kitaoka |
120a6e |
this->m_input->allocateAndCompute(
|
|
Shinya Kitaoka |
120a6e |
tile_allocated, tile_with_margin.getP00(),
|
|
Shinya Kitaoka |
120a6e |
TDimensionI(/* Pixel単位で四捨五入 */
|
|
Shinya Kitaoka |
120a6e |
static_cast<int>(tile_with_margin.getLx() + 0.5),</int>
|
|
Shinya Kitaoka |
120a6e |
static_cast<int>(tile_with_margin.getLy() + 0.5)),</int>
|
|
Shinya Kitaoka |
120a6e |
tile.getRaster(), frame, ri);
|
|
Shinya Kitaoka |
120a6e |
/*------ 参照画像生成 --------------------------------------*/
|
|
Shinya Kitaoka |
120a6e |
TTile reference_tile;
|
|
Shinya Kitaoka |
120a6e |
bool reference_sw = false;
|
|
Shinya Kitaoka |
120a6e |
if (this->m_refer.isConnected()) {
|
|
Shinya Kitaoka |
120a6e |
reference_sw = true;
|
|
Shinya Kitaoka |
120a6e |
this->m_refer->allocateAndCompute(
|
|
Shinya Kitaoka |
120a6e |
reference_tile, tile_with_margin.getP00(),
|
|
Shinya Kitaoka |
120a6e |
TDimensionI(/* Pixel単位で四捨五入 */
|
|
Shinya Kitaoka |
120a6e |
static_cast<int>(tile_with_margin.getLx() + 0.5),</int>
|
|
Shinya Kitaoka |
120a6e |
static_cast<int>(tile_with_margin.getLy() + 0.5)),</int>
|
|
Shinya Kitaoka |
120a6e |
tile.getRaster(), frame, ri);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
/* ------ 保存すべき画像メモリを塗りつぶしクリア ---------- */
|
|
Shinya Kitaoka |
120a6e |
tile.getRaster()->clear(); /* 塗りつぶしクリア */
|
|
Shinya Kitaoka |
120a6e |
/* ------ (app_begin)log記憶 ------------------------------ */
|
|
Shinya Kitaoka |
120a6e |
const bool log_sw = ino::log_enable_sw();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (log_sw) {
|
|
Shinya Kitaoka |
120a6e |
std::ostringstream os;
|
|
Shinya Kitaoka |
120a6e |
os << "params"
|
|
Shinya Kitaoka |
120a6e |
<< " cx " << center.x << " cy " << center.y << " blur " << blur
|
|
Shinya Kitaoka |
120a6e |
<< " radius " << radius << " twist " << twist
|
|
Shinya Kitaoka |
120a6e |
// << " twist_radius " << twist_radius
|
|
Shinya Kitaoka |
120a6e |
<< " reference " << ref_mode << " alpha_rendering " << alpha_rend_sw
|
|
Shinya Kitaoka |
120a6e |
<< " anti_alias " << anti_alias_sw << " render_center "
|
|
Shinya Kitaoka |
120a6e |
<< render_center << " frame " << frame << " pixbits "
|
|
Shinya Kitaoka |
120a6e |
<< ino::pixel_bits(tile.getRaster()) << " tile.m_pos " << tile.m_pos
|
|
Shinya Kitaoka |
120a6e |
<< " tile_getLx " << tile.getRaster()->getLx() << " y "
|
|
Shinya Kitaoka |
120a6e |
<< tile.getRaster()->getLy() << " ri.m_cameraBox " << ri.m_cameraBox
|
|
Shinya Kitaoka |
120a6e |
<< " ri.m_affine " << ri.m_affine << " ri_m_affine_det "
|
|
Shinya Kitaoka |
120a6e |
<< ri.m_affine.det() << " shrink_x " << ri.m_shrinkX << " shrink_y "
|
|
Shinya Kitaoka |
120a6e |
<< ri.m_shrinkY << " tile_with_margin " << tile_with_margin
|
|
Shinya Kitaoka |
120a6e |
<< " tile_allocated.m_pos " << tile_allocated.m_pos
|
|
Shinya Kitaoka |
120a6e |
<< " tile_allocated_getLx " << tile_allocated.getRaster()->getLx()
|
|
Shinya Kitaoka |
120a6e |
<< " y " << tile_allocated.getRaster()->getLy();
|
|
Shinya Kitaoka |
120a6e |
if (reference_sw) {
|
|
Shinya Kitaoka |
120a6e |
os << " reference_tile.m_pos " << reference_tile.m_pos
|
|
Shinya Kitaoka |
120a6e |
<< " reference_tile_getLx " << reference_tile.getRaster()->getLx()
|
|
Shinya Kitaoka |
120a6e |
<< " y " << reference_tile.getRaster()->getLy();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
/* ------ fx処理 ------------------------------------------ */
|
|
Shinya Kitaoka |
120a6e |
try {
|
|
Shinya Kitaoka |
120a6e |
tile.getRaster()->lock();
|
|
Shinya Kitaoka |
120a6e |
fx_(tile_allocated.getRaster(), margin
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
(reference_sw ? reference_tile.getRaster() : nullptr), ref_mode
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
tile.getRaster()
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
render_center.x, render_center.y, twist, 0.0 // twist_radius
|
|
Shinya Kitaoka |
120a6e |
,
|
|
Shinya Kitaoka |
120a6e |
blur, radius, alpha_rend_sw, anti_alias_sw);
|
|
Shinya Kitaoka |
120a6e |
tile.getRaster()->unlock();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
/* ------ error処理 --------------------------------------- */
|
|
Shinya Kitaoka |
120a6e |
catch (std::bad_alloc &e) {
|
|
Shinya Kitaoka |
120a6e |
tile.getRaster()->unlock();
|
|
Shinya Kitaoka |
120a6e |
if (log_sw) {
|
|
Shinya Kitaoka |
120a6e |
std::string str("std::bad_alloc <");
|
|
Shinya Kitaoka |
120a6e |
str += e.what();
|
|
Shinya Kitaoka |
120a6e |
str += '>';
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
throw;
|
|
Shinya Kitaoka |
120a6e |
} catch (std::exception &e) {
|
|
Shinya Kitaoka |
120a6e |
tile.getRaster()->unlock();
|
|
Shinya Kitaoka |
120a6e |
if (log_sw) {
|
|
Shinya Kitaoka |
120a6e |
std::string str("exception <");
|
|
Shinya Kitaoka |
120a6e |
str += e.what();
|
|
Shinya Kitaoka |
120a6e |
str += '>';
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
throw;
|
|
Shinya Kitaoka |
120a6e |
} catch (...) {
|
|
Shinya Kitaoka |
120a6e |
tile.getRaster()->unlock();
|
|
Shinya Kitaoka |
120a6e |
if (log_sw) {
|
|
Shinya Kitaoka |
120a6e |
std::string str("other exception");
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
throw;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|