Toshihiro Shimizu 890ddd
#include <sstream> /* std::ostringstream */</sstream>
Toshihiro Shimizu 890ddd
#include "tfxparam.h"
Toshihiro Shimizu 890ddd
#include "stdfx.h"
Toshihiro Shimizu 890ddd
#include "tfxattributes.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "ino_common.h"
Toshihiro Shimizu 890ddd
//------------------------------------------------------------
Shinya Kitaoka d1f6c4
class ino_motion_blur final : public TStandardRasterFx {
Shinya Kitaoka 120a6e
  FX_PLUGIN_DECLARATION(ino_motion_blur)
Shinya Kitaoka 120a6e
  TRasterFxPort m_input;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TIntEnumParamP m_depend_move;
Shinya Kitaoka 120a6e
  TDoubleParamP m_x1;
Shinya Kitaoka 120a6e
  TDoubleParamP m_y1;
Shinya Kitaoka 120a6e
  TDoubleParamP m_x2;
Shinya Kitaoka 120a6e
  TDoubleParamP m_y2;
Shinya Kitaoka 120a6e
  TDoubleParamP m_scale;
Shinya Kitaoka 120a6e
  TDoubleParamP m_curve;
Shinya Kitaoka 120a6e
  TDoubleParamP m_zanzo_length;
Shinya Kitaoka 120a6e
  TDoubleParamP m_zanzo_power;
Shinya Kitaoka 120a6e
  TBoolParamP m_alpha_rendering;
Shinya Kitaoka 120a6e
  // TBoolParamP m_spread;
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ino_motion_blur()
Shinya Kitaoka 120a6e
      : m_depend_move(new TIntEnumParam(0, "P1 -> P2"))
Shinya Kitaoka 120a6e
      , m_x1(0.0)
Shinya Kitaoka 120a6e
      , m_y1(0.0)
Shinya Kitaoka 120a6e
      , m_x2(1.0)
Shinya Kitaoka 120a6e
      , m_y2(1.0)
Shinya Kitaoka 120a6e
      , m_scale(1.0 * ino::param_range())
Shinya Kitaoka 120a6e
      , m_curve(1.0 * ino::param_range())
Shinya Kitaoka 120a6e
      , m_zanzo_length(0.0)
Shinya Kitaoka 120a6e
      , m_zanzo_power(1.0 * ino::param_range())
Shinya Kitaoka 120a6e
      , m_alpha_rendering(true)
Shinya Kitaoka 120a6e
  // , m_spread(true)
Shinya Kitaoka 120a6e
  {
Shinya Kitaoka 120a6e
    this->m_x1->setMeasureName("fxLength");
Shinya Kitaoka 120a6e
    this->m_y1->setMeasureName("fxLength");
Shinya Kitaoka 120a6e
    this->m_x2->setMeasureName("fxLength");
Shinya Kitaoka 120a6e
    this->m_y2->setMeasureName("fxLength");
Shinya Kitaoka 120a6e
    this->m_zanzo_length->setMeasureName("fxLength");
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    addInputPort("Source", this->m_input);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    bindParam(this, "depend_move", this->m_depend_move);
Shinya Kitaoka 120a6e
    bindParam(this, "x1", this->m_x1);
Shinya Kitaoka 120a6e
    bindParam(this, "y1", this->m_y1);
Shinya Kitaoka 120a6e
    bindParam(this, "x2", this->m_x2);
Shinya Kitaoka 120a6e
    bindParam(this, "y2", this->m_y2);
Shinya Kitaoka 120a6e
    bindParam(this, "scale", this->m_scale);
Shinya Kitaoka 120a6e
    bindParam(this, "curve", this->m_curve);
Shinya Kitaoka 120a6e
    bindParam(this, "zanzo_length", this->m_zanzo_length);
Shinya Kitaoka 120a6e
    bindParam(this, "zanzo_power", this->m_zanzo_power);
Shinya Kitaoka 120a6e
    bindParam(this, "alpha_rendering", this->m_alpha_rendering);
Shinya Kitaoka 120a6e
    // bindParam(this,"spread", this->m_spread);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    this->m_depend_move->addItem(1, "Motion");
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    this->m_curve->setValueRange(0.1 * ino::param_range(),
Shinya Kitaoka 120a6e
                                 10.0 * ino::param_range()); /* gamma値 */
Shinya Kitaoka 120a6e
    this->m_zanzo_length->setValueRange(0.0, 1000.0);
Shinya Kitaoka 120a6e
    this->m_zanzo_power->setValueRange(0.0 * ino::param_range(),
Shinya Kitaoka 120a6e
                                       1.0 * ino::param_range());
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    this->getAttributes()->setIsSpeedAware(true);
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  //------------------------------------------------------------
Shinya Kitaoka 120a6e
  void get_render_vector(const double frame, const TAffine affine,
Shinya Kitaoka 120a6e
                         TPointD &rend_vect) {
Shinya Kitaoka 120a6e
    /*--- ベクトルを得て、render用単位にする ---*/
Shinya Kitaoka 120a6e
    if (0 == this->m_depend_move->getValue()) {
Shinya Kitaoka 120a6e
      rend_vect.x = this->m_x2->getValue(frame) - this->m_x1->getValue(frame);
Shinya Kitaoka 120a6e
      rend_vect.y = this->m_y2->getValue(frame) - this->m_y1->getValue(frame);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
      rend_vect = rend_vect * ino::pixel_per_mm();
Shinya Kitaoka 120a6e
      /* 単位変換(mm --> render_pixel) */
Shinya Kitaoka 120a6e
    } else {
Shinya Kitaoka 120a6e
      rend_vect = -this->getAttributes()->getSpeed();
Shinya Kitaoka 120a6e
    }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    /*--- 回転と拡大縮小のGeometryを反映させる ---*/
Shinya Kitaoka 120a6e
    /*
Shinya Kitaoka 120a6e
    toonz/main/sources/stdfx/motionblurfx.cpp
Shinya Kitaoka 120a6e
    750-768行を参照して書いた
Shinya Kitaoka 120a6e
    */
Shinya Kitaoka 120a6e
    TAffine aff(affine);
Shinya Kitaoka 120a6e
    aff.a13 = aff.a23 = 0; /* 移動変換をしないで... */
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    rend_vect = aff * rend_vect;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    /*--- ユーザー指定による、強弱を付加する ---*/
Shinya Kitaoka 120a6e
    rend_vect =
Shinya Kitaoka 120a6e
        rend_vect * (this->m_scale->getValue(frame) / ino::param_range());
Shinya Kitaoka 120a6e
    /*--- shrinkはGeometry(affine)に含まれる...らしい ---*/
Shinya Kitaoka 120a6e
    // rend_vect = rend_vect
Shinya Kitaoka 120a6e
    //	* (1.0 / ((info.m_shrinkX + info.m_shrinkY)/2.));
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  int get_render_margin(const double frame, const TAffine affine) {
Shinya Kitaoka 120a6e
    TPointD rend_vect;
Shinya Kitaoka 120a6e
    this->get_render_vector(frame, affine, rend_vect);
Shinya Kitaoka 120a6e
    return static_cast<int>(ceil((fabs(rend_vect.x) < fabs(rend_vect.y))</int>
Shinya Kitaoka 120a6e
                                     ? fabs(rend_vect.y)
Shinya Kitaoka 120a6e
                                     : fabs(rend_vect.x)) +
Shinya Kitaoka 120a6e
                            0.5);
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  void get_render_enlarge(const double frame, const TAffine affine,
Shinya Kitaoka 120a6e
                          TRectD &bBox) {
Shinya Kitaoka 120a6e
    const int margin = this->get_render_margin(frame, affine);
Shinya Kitaoka 120a6e
    if (0 < margin) {
Shinya Kitaoka 120a6e
      bBox = bBox.enlarge(static_cast<double>(margin));</double>
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 (false == 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
    if (0 == this->m_depend_move->getValue()) {
Shinya Kitaoka 120a6e
      return true;
Shinya Kitaoka 120a6e
    } else {
Shinya Kitaoka 120a6e
      return isAlmostIsotropic(info.m_affine) || m_scale->getValue(frame) == 0;
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 38fd86
  void doCompute(TTile &tile, double frame,
Shinya Kitaoka 38fd86
                 const TRenderSettings &rend_sets) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
FX_PLUGIN_IDENTIFIER(ino_motion_blur, "inoMotionBlurFx");
Toshihiro Shimizu 890ddd
//------------------------------------------------------------
Toshihiro Shimizu 890ddd
#include "igs_motion_blur.h"
Shinya Kitaoka 120a6e
namespace {
Toshihiro Shimizu 890ddd
template <class class="" t="" u,=""></class>
Shinya Kitaoka 120a6e
void arr_to_ras_(const U *arr, const int channels, TRasterPT<t> ras,</t>
Shinya Kitaoka 120a6e
                 const int margin) {
Shinya Kitaoka 120a6e
  arr +=
Shinya Kitaoka 120a6e
      (ras->getLx() + margin + margin) * margin * channels + margin * channels;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  for (int yy = 0; yy < ras->getLy();
Shinya Kitaoka 120a6e
       ++yy, arr += (ras->getLx() + margin + margin) * channels) {
Shinya Kitaoka 120a6e
    const U *arrx = arr;
Shinya Kitaoka 120a6e
    T *ras_sl     = ras->pixels(yy);
Shinya Kitaoka 120a6e
    for (int xx = 0; xx < ras->getLx(); ++xx, arrx += channels) {
Shinya Kitaoka 120a6e
      ras_sl[xx].b = arrx[0];
Shinya Kitaoka 120a6e
      ras_sl[xx].g = arrx[1];
Shinya Kitaoka 120a6e
      ras_sl[xx].r = arrx[2];
Shinya Kitaoka 120a6e
      ras_sl[xx].m = arrx[3];
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Shinya Kitaoka 120a6e
void vec_to_ras_(unsigned char *vec, const int channels, TRasterP ras,
Shinya Kitaoka 120a6e
                 const int margin) {
Shinya Kitaoka 120a6e
  if ((TRaster32P)ras) {
Shinya Kitaoka 120a6e
    arr_to_ras_<unsigned char,="" tpixel32="">(vec, channels, ras, margin);</unsigned>
Shinya Kitaoka 120a6e
  } else if ((TRaster64P)ras) {
Shinya Kitaoka 120a6e
    arr_to_ras_<unsigned short,="" tpixel64="">(</unsigned>
Shinya Kitaoka 120a6e
        reinterpret_cast<unsigned *="" short="">(vec), channels, ras, margin);</unsigned>
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Shinya Kitaoka 120a6e
void fx_(const TRasterP in_ras  // with margin
Shinya Kitaoka 120a6e
         ,
Shinya Kitaoka 120a6e
         const int margin, TRasterP out_ras  // no margin
Shinya Kitaoka 120a6e
         ,
Shinya Kitaoka 120a6e
         const double x_vector, const double y_vector, const double scale,
Shinya Kitaoka 120a6e
         const double curve, const int zanzo_length, const double zanzo_power,
Shinya Kitaoka 120a6e
         const bool alp_rend_sw) {
Shinya Kitaoka 120a6e
  /******
Shinya Kitaoka 120a6e
  std::vector<unsigned char=""> in_vec;</unsigned>
Shinya Kitaoka 120a6e
  ino::ras_to_vec( in_ras, ino::channels(), in_vec );
Shinya Kitaoka 120a6e
  std::vector<unsigned char=""> out_vec(in_vec.size());</unsigned>
Toshihiro Shimizu 890ddd
******/
Shinya Kitaoka 120a6e
  /***	int out_size = in_ras->getLy()*in_ras->getLx()*ino::channels();
Shinya Kitaoka 120a6e
  if ((TRaster64P)in_ras) { out_size *= sizeof(unsigned short) ; }
Shinya Kitaoka 120a6e
  TRasterGR8P out_byt(out_size, 1);
Shinya Kitaoka 120a6e
  //TRasterGR8P out_byt; out_byt->create(out_size, 1);
Shinya Kitaoka 120a6e
  //TRasterP out_byt = TRasterGR8P(out_size, 1);
Shinya Kitaoka 120a6e
  out_byt->lock();
Shinya Kitaoka 120a6e
  if (0 == out_byt->getRawData()) {
Shinya Kitaoka 120a6e
   throw TRopException("Can not get TRasterGR8P->getRawData()");
Shinya Kitaoka 120a6e
  }***/
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TRasterGR8P out_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
  out_gr8->lock();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  igs::motion_blur::convert(
Shinya Kitaoka 120a6e
      in_ras->getRawData()  // BGRA
Shinya Kitaoka 120a6e
      //&in_vec.at(0) // RGBA
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
      //, out_byt->getRawData() // BGRA
Shinya Kitaoka 120a6e
      //, &out_vec.at(0)    // RGBA
Shinya Kitaoka 120a6e
      //, out_ras->getRawData() // BGRA
Shinya Kitaoka 120a6e
      ,
Shinya Kitaoka 120a6e
      out_gr8->getRawData()
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
          ,
Shinya Kitaoka 120a6e
      in_ras->getLy(), in_ras->getLx(), ino::channels(), ino::bits(in_ras)
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
                                                             ,
Shinya Kitaoka 120a6e
      x_vector, y_vector, scale, curve, zanzo_length, zanzo_power, alp_rend_sw);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  /******
Shinya Kitaoka 120a6e
  ino::vec_to_ras( out_vec, ino::channels(), out_ras, margin );
Shinya Kitaoka 120a6e
  in_vec.clear();
Toshihiro Shimizu 890ddd
******/
Shinya Kitaoka 120a6e
  /***vec_to_ras_(out_byt->getRawData(),ino::channels(),out_ras,margin);
Shinya Kitaoka 120a6e
  out_byt->unlock();***/
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ino::arr_to_ras(out_gr8->getRawData(), ino::channels(), out_ras, margin);
Shinya Kitaoka 120a6e
  out_gr8->unlock();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
//------------------------------------------------------------
Shinya Kitaoka 120a6e
void ino_motion_blur::doCompute(TTile &tile, double frame,
Shinya Kitaoka 120a6e
                                const TRenderSettings &rend_sets) {
Shinya Kitaoka 120a6e
  /* ------ 接続していなければ処理しない -------------------- */
Shinya Kitaoka 120a6e
  if (!this->m_input.isConnected()) {
Shinya Kitaoka 120a6e
    tile.getRaster()->clear(); /* 塗りつぶしクリア */
Shinya Kitaoka 120a6e
    return;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
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
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  /* ------ Render(Pixel)単位で動作パラメータを得る --------- */
Shinya Kitaoka 120a6e
  const int depend_move  = this->m_depend_move->getValue();
Shinya Kitaoka 120a6e
  const double scale     = this->m_scale->getValue(frame) / ino::param_range();
Shinya Kitaoka 120a6e
  const double curve     = this->m_curve->getValue(frame) / ino::param_range();
Shinya Kitaoka 120a6e
  const int zanzo_length = this->m_zanzo_length->getValue(frame) *
Shinya Kitaoka 120a6e
                           ino::pixel_per_mm() *
Shinya Kitaoka 120a6e
                           sqrt(fabs(rend_sets.m_affine.det())) /
Shinya Kitaoka 120a6e
                           ((rend_sets.m_shrinkX + rend_sets.m_shrinkY) / 2.0);
Shinya Kitaoka 120a6e
  const double zanzo_power =
Shinya Kitaoka 120a6e
      this->m_zanzo_power->getValue(frame) / ino::param_range();
Shinya Kitaoka 120a6e
  const bool alp_rend_sw = this->m_alpha_rendering->getValue();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  /* ------ 実際に処理するぼかしの方向vectorを生成 ---------- */
Shinya Kitaoka 120a6e
  TPointD rend_vect;
Shinya Kitaoka 120a6e
  this->get_render_vector(frame, rend_sets.m_affine, rend_vect);
Shinya Kitaoka 120a6e
  /* ------ 参照マージンの大きさを得る ---------------------- */
Shinya Kitaoka 120a6e
  const int margin = static_cast<int>(</int>
Shinya Kitaoka 120a6e
      ceil((fabs(rend_vect.x) < fabs(rend_vect.y)) ? fabs(rend_vect.y)
Shinya Kitaoka 120a6e
                                                   : fabs(rend_vect.x)) +
Shinya Kitaoka 120a6e
      0.5);
Shinya Kitaoka 120a6e
  /* ------ 参照マージン含めた画像を生成 -------------------- */
Shinya Kitaoka 120a6e
  TRectD bBox =
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
  if (0 < margin) {
Shinya Kitaoka 120a6e
    bBox = bBox.enlarge(static_cast<double>(margin));</double>
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TTile enlarge_tile;
Shinya Kitaoka 120a6e
  this->m_input->allocateAndCompute(
Shinya Kitaoka 120a6e
      enlarge_tile, bBox.getP00(),
Shinya Kitaoka 120a6e
      TDimensionI(/* Pixel単位のdouble -> intにしてセット */
Shinya Kitaoka 120a6e
                  static_cast<int>(bBox.getLx() + 0.5),</int>
Shinya Kitaoka 120a6e
                  static_cast<int>(bBox.getLy() + 0.5)),</int>
Shinya Kitaoka 120a6e
      tile.getRaster(), frame, rend_sets);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  /* ------ 保存すべき画像メモリを塗りつぶしクリア ---------- */
Shinya Kitaoka 120a6e
  tile.getRaster()->clear(); /* 塗りつぶしクリア */
Toshihiro Shimizu 890ddd
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
       << "  depend_move_num " << depend_move << "  render_vector x "
Shinya Kitaoka 120a6e
       << rend_vect.x << "  y " << rend_vect.y << "  margin " << margin
Shinya Kitaoka 120a6e
       << "  scale " << scale << "  curve " << curve << "  z_len "
Shinya Kitaoka 120a6e
       << zanzo_length << "  z_pow " << zanzo_power << "  alp_rend_sw "
Shinya Kitaoka 120a6e
       << alp_rend_sw << "   tile w " << tile.getRaster()->getLx() << "  h "
Shinya Kitaoka 120a6e
       << tile.getRaster()->getLy() << "  pixbits "
Shinya Kitaoka 120a6e
       << ino::pixel_bits(tile.getRaster()) << "   frame " << frame
Shinya Kitaoka 120a6e
       << "   rand_sets affine_det " << rend_sets.m_affine.det() << "  a11 "
Shinya Kitaoka 120a6e
       << rend_sets.m_affine.a11 << "  a12 " << rend_sets.m_affine.a12
Shinya Kitaoka 120a6e
       << "  a13 " << rend_sets.m_affine.a13 << "  a21 "
Shinya Kitaoka 120a6e
       << rend_sets.m_affine.a21 << "  a22 " << rend_sets.m_affine.a22
Shinya Kitaoka 120a6e
       << "  a23 " << rend_sets.m_affine.a23 << "  x " << rend_sets.m_shrinkX
Shinya Kitaoka 120a6e
       << "  y " << rend_sets.m_shrinkY;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  /* ------ fx処理 ------------------------------------------ */
Shinya Kitaoka 120a6e
  try {
Shinya Kitaoka 120a6e
    tile.getRaster()->lock();
Shinya Kitaoka 120a6e
    fx_(enlarge_tile.getRaster()  // in with margin
Shinya Kitaoka 120a6e
        ,
Shinya Kitaoka 120a6e
        margin  // margin
Shinya Kitaoka 120a6e
        ,
Shinya Kitaoka 120a6e
        tile.getRaster()  // out with no margin
Shinya Kitaoka 120a6e
        ,
Shinya Kitaoka 120a6e
        rend_vect.x, rend_vect.y, scale, curve, zanzo_length, zanzo_power,
Shinya Kitaoka 120a6e
        alp_rend_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
}