Example #1
0
bool xml::Node::hasAttribute(const std::string& name) const
{
    auto attrs = getAttributes();
    return attrs.find(name) != attrs.end();
}
Example #2
0
void RtfGenerator::printBody()
{

 *out << "{\\rtf1\\ansi\\uc0 \\deff1"
       << "{\\fonttbl{\\f1\\fmodern\\fprq1\\fcharset0 " ;
 *out << this->getBaseFont() ;
 *out << ";}}"
      << "{\\colortbl;";


   *out    << "\\red"    << (docStyle.getBgColour().getRed(RTF));
   *out    << "\\green"    << (docStyle.getBgColour().getGreen(RTF));
   *out    << "\\blue"    << (docStyle.getBgColour().getBlue(RTF));
   *out     << ";";

  *out << getAttributes(docStyle.getDefaultStyle());

  *out << getAttributes(docStyle.getStringStyle());
  *out << getAttributes(docStyle.getNumberStyle());
  *out << getAttributes(docStyle.getSingleLineCommentStyle());

  *out << getAttributes(docStyle.getCommentStyle());
  *out << getAttributes(docStyle.getEscapeCharStyle());
  *out << getAttributes(docStyle.getDirectiveStyle());

  *out << getAttributes(docStyle.getDirectiveStringStyle());
  *out << getAttributes(docStyle.getLineStyle());
  *out << getAttributes(docStyle.getSymbolStyle());

  /* For output formats which can refer to external styles it is more safe
     to use the colour theme's keyword class names, since the language
     definitions (which may change during a batch conversion) do not have to define
     all keyword classes, that are needed to highlight all input files correctly.
     It is ok for RTF to use the language definition's class names, because RTF
     does not refer to external styles.
     We cannot use the theme's class names, because KSIterator returns an
     alphabetically ordered list, which is not good because RTF is dependent
     on the order. We access the keyword style with an ID, which is calculated
     ignoring the alphabetic order.
  */
  vector<string>  keywordClasses = langInfo.getKeywordClasses();
  for (unsigned int i=0;i<keywordClasses.size();i++){
      *out << getAttributes(docStyle.getKeywordStyle(keywordClasses[i]));
  }

  *out << "}\n";

  *out  << "\\paperw"<< psMap[pageSize].width <<"\\paperh"<< psMap[pageSize].height
        << "\\margl1134\\margr1134\\margt1134\\margb1134\\sectd" // page margins
        << "\\plain\\f1\\fs" ;  // Font formatting
  int fontSize=0;
  StringTools::str2num<int>(fontSize, this->getBaseFontSize(), std::dec);
  *out << ((fontSize)? fontSize*2: 20);  // RTF needs double amount
  *out << "\n\\pard \\cbpat1{";

  processRootState();

  *out << "}}"<<endl;
}
Example #3
0
void Iwa_MotionBlurCompFx::doCompute(TTile &tile, double frame,
                                     const TRenderSettings &settings) {
  /*- 接続していない場合は処理しない -*/
  if (!m_input.isConnected() && !m_background.isConnected()) {
    tile.getRaster()->clear();
    return;
  }
  /*- BGのみ接続の場合 -*/
  if (!m_input.isConnected()) {
    m_background->compute(tile, frame, settings);
    return;
  }

  /*- 動作パラメータを得る -*/
  QList<TPointD> points = getAttributes()->getMotionPoints();
  double hardness       = m_hardness->getValue(frame);
  double shutterStart   = m_shutterStart->getValue(frame);
  double shutterEnd     = m_shutterEnd->getValue(frame);
  int traceResolution   = m_traceResolution->getValue();
  float startValue      = (float)m_startValue->getValue(frame);
  float startCurve      = (float)m_startCurve->getValue(frame);
  float endValue        = (float)m_endValue->getValue(frame);
  float endCurve        = (float)m_endCurve->getValue(frame);

  /*- 軌跡データが2つ以上無い場合は、処理しない -*/
  if (points.size() < 2) {
    if (!m_background.isConnected()) m_input->compute(tile, frame, settings);
    /*- 背景があり、前景が動かない場合、単純にOverする -*/
    else
      composeWithNoMotion(tile, frame, settings);
    return;
  }
  /*-  表示の範囲を得る -*/
  TRectD bBox =
      TRectD(tile.m_pos /*- Render画像上(Pixel単位)の位置 -*/
             ,
             TDimensionD(/*- Render画像上(Pixel単位)のサイズ -*/
                         tile.getRaster()->getLx(), tile.getRaster()->getLy()));

  /*- 上下左右のマージンを得る -*/
  double minX = 0.0;
  double maxX = 0.0;
  double minY = 0.0;
  double maxY = 0.0;
  for (int p = 0; p < points.size(); p++) {
    if (points.at(p).x > maxX) maxX = points.at(p).x;
    if (points.at(p).x < minX) minX = points.at(p).x;
    if (points.at(p).y > maxY) maxY = points.at(p).y;
    if (points.at(p).y < minY) minY = points.at(p).y;
  }
  int marginLeft   = (int)ceil(abs(minX));
  int marginRight  = (int)ceil(abs(maxX));
  int marginTop    = (int)ceil(abs(maxY));
  int marginBottom = (int)ceil(abs(minY));

  /*- 動かない(=フィルタマージンが全て0)場合、入力タイルをそのまま返す -*/
  if (marginLeft == 0 && marginRight == 0 && marginTop == 0 &&
      marginBottom == 0) {
    if (!m_background.isConnected()) m_input->compute(tile, frame, settings);
    /*- 背景があり、前景が動かない場合、単純にOverする -*/
    else
      composeWithNoMotion(tile, frame, settings);
    return;
  }

  /*- マージンは、フィルタの上下左右を反転した寸法になる -*/
  TRectD enlargedBBox(bBox.x0 - (double)marginRight,
                      bBox.y0 - (double)marginTop, bBox.x1 + (double)marginLeft,
                      bBox.y1 + (double)marginBottom);

  // std::cout<<"Margin Left:"<<marginLeft<<" Right:"<<marginRight<<
  //	" Bottom:"<<marginBottom<<" Top:"<<marginTop<<std::endl;

  TDimensionI enlargedDimIn(/*- Pixel単位に四捨五入 -*/
                            (int)(enlargedBBox.getLx() + 0.5),
                            (int)(enlargedBBox.getLy() + 0.5));

  TTile enlarge_tile;
  m_input->allocateAndCompute(enlarge_tile, enlargedBBox.getP00(),
                              enlargedDimIn, tile.getRaster(), frame, settings);

  /*- 背景が必要な場合 -*/
  TTile back_Tile;
  if (m_background.isConnected()) {
    m_background->allocateAndCompute(back_Tile, tile.m_pos,
                                     tile.getRaster()->getSize(),
                                     tile.getRaster(), frame, settings);
  }

  //-------------------------------------------------------
  /*- 計算範囲 -*/
  TDimensionI dimOut(tile.getRaster()->getLx(), tile.getRaster()->getLy());
  TDimensionI filterDim(marginLeft + marginRight + 1,
                        marginTop + marginBottom + 1);

  /*- pointsTableの解放は各doCompute内でやっている -*/
  int pointAmount     = points.size();
  float4 *pointsTable = new float4[pointAmount];
  float dt = (float)(shutterStart + shutterEnd) / (float)traceResolution;
  for (int p = 0; p < pointAmount; p++) {
    pointsTable[p].x = (float)points.at(p).x;
    pointsTable[p].y = (float)points.at(p).y;
    /*- zにはp→p+1のベクトルの距離を格納 -*/
    if (p < pointAmount - 1) {
      float2 vec = {(float)(points.at(p + 1).x - points.at(p).x),
                    (float)(points.at(p + 1).y - points.at(p).y)};
      pointsTable[p].z = sqrtf(vec.x * vec.x + vec.y * vec.y);
    }
    /*- wにはシャッター時間のオフセットを格納 -*/
    pointsTable[p].w = -(float)shutterStart + (float)p * dt;
  }

  doCompute_CPU(tile, frame, settings, pointsTable, pointAmount, hardness,
                shutterStart, shutterEnd, traceResolution, startValue,
                startCurve, endValue, endCurve, marginLeft, marginRight,
                marginTop, marginBottom, enlargedDimIn, enlarge_tile, dimOut,
                filterDim, back_Tile);
}