当前位置: 首页>>代码示例>>C++>>正文


C++ SVGPathTraversalState类代码示例

本文整理汇总了C++中SVGPathTraversalState的典型用法代码示例。如果您正苦于以下问题:C++ SVGPathTraversalState类的具体用法?C++ SVGPathTraversalState怎么用?C++ SVGPathTraversalState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SVGPathTraversalState类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TraverseLinetoVerticalRel

static void
TraverseLinetoVerticalRel(const float* aArgs, SVGPathTraversalState& aState)
{
  aState.pos.y += aArgs[0];
  if (aState.ShouldUpdateLengthAndControlPoints()) {
    aState.length += fabs(aArgs[0]);
    aState.cp1 = aState.cp2 = aState.pos;
  }
}
开发者ID:ehsan,项目名称:mozilla-history,代码行数:9,代码来源:SVGPathSegUtils.cpp

示例2: TraverseMovetoRel

static void
TraverseMovetoRel(const float* aArgs, SVGPathTraversalState& aState)
{
  aState.start = aState.pos += gfxPoint(aArgs[0], aArgs[1]);
  if (aState.ShouldUpdateLengthAndControlPoints()) {
    // aState.length is unchanged, since move commands don't affect path length.
    aState.cp1 = aState.cp2 = aState.start;
  }
}
开发者ID:ehsan,项目名称:mozilla-history,代码行数:9,代码来源:SVGPathSegUtils.cpp

示例3: TraverseClosePath

static void
TraverseClosePath(const float* aArgs, SVGPathTraversalState& aState)
{
  if (aState.ShouldUpdateLengthAndControlPoints()) {
    aState.length += CalcDistanceBetweenPoints(aState.pos, aState.start);
    aState.cp1 = aState.cp2 = aState.start;
  }
  aState.pos = aState.start;
}
开发者ID:ehsan,项目名称:mozilla-history,代码行数:9,代码来源:SVGPathSegUtils.cpp

示例4: TraverseLinetoVerticalAbs

static void
TraverseLinetoVerticalAbs(const float* aArgs, SVGPathTraversalState& aState)
{
  gfxPoint to(aState.pos.x, aArgs[0]);
  if (aState.ShouldUpdateLengthAndControlPoints()) {
    aState.length += fabs(to.y - aState.pos.y);
    aState.cp1 = aState.cp2 = to;
  }
  aState.pos = to;
}
开发者ID:ehsan,项目名称:mozilla-history,代码行数:10,代码来源:SVGPathSegUtils.cpp

示例5: TraverseLinetoRel

static void
TraverseLinetoRel(const float* aArgs, SVGPathTraversalState& aState)
{
  gfxPoint to = aState.pos + gfxPoint(aArgs[0], aArgs[1]);
  if (aState.ShouldUpdateLengthAndControlPoints()) {
    aState.length += CalcDistanceBetweenPoints(aState.pos, to);
    aState.cp1 = aState.cp2 = to;
  }
  aState.pos = to;
}
开发者ID:ehsan,项目名称:mozilla-history,代码行数:10,代码来源:SVGPathSegUtils.cpp

示例6: TraverseLinetoHorizontalAbs

static void
TraverseLinetoHorizontalAbs(const float* aArgs, SVGPathTraversalState& aState)
{
  Point to(aArgs[0], aState.pos.y);
  if (aState.ShouldUpdateLengthAndControlPoints()) {
    aState.length += fabs(to.x - aState.pos.x);
    aState.cp1 = aState.cp2 = to;
  }
  aState.pos = to;
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:10,代码来源:SVGPathSegUtils.cpp

示例7: TraverseCurvetoQuadraticRel

static void
TraverseCurvetoQuadraticRel(const float* aArgs, SVGPathTraversalState& aState)
{
  gfxPoint to = aState.pos + gfxPoint(aArgs[2], aArgs[3]);
  if (aState.ShouldUpdateLengthAndControlPoints()) {
    gfxPoint cp = aState.pos + gfxPoint(aArgs[0], aArgs[1]);
    aState.length += (float)CalcLengthOfQuadraticBezier(aState.pos, cp, to);
    aState.cp1 = cp;
    aState.cp2 = to;
  }
  aState.pos = to;
}
开发者ID:ehsan,项目名称:mozilla-history,代码行数:12,代码来源:SVGPathSegUtils.cpp

示例8: TraverseCurvetoCubicSmoothRel

static void
TraverseCurvetoCubicSmoothRel(const float* aArgs, SVGPathTraversalState& aState)
{
  gfxPoint to = aState.pos + gfxPoint(aArgs[2], aArgs[3]);
  if (aState.ShouldUpdateLengthAndControlPoints()) {
    gfxPoint cp1 = aState.pos - (aState.cp2 - aState.pos);
    gfxPoint cp2 = aState.pos + gfxPoint(aArgs[0], aArgs[1]);
    aState.length += (float)CalcLengthOfCubicBezier(aState.pos, cp1, cp2, to);
    aState.cp2 = cp2;
    aState.cp1 = to;
  }
  aState.pos = to;
}
开发者ID:ehsan,项目名称:mozilla-history,代码行数:13,代码来源:SVGPathSegUtils.cpp

示例9: TraverseCurvetoCubicAbs

static void
TraverseCurvetoCubicAbs(const float* aArgs, SVGPathTraversalState& aState)
{
  Point to(aArgs[4], aArgs[5]);
  if (aState.ShouldUpdateLengthAndControlPoints()) {
    Point cp1(aArgs[0], aArgs[1]);
    Point cp2(aArgs[2], aArgs[3]);
    aState.length += (float)CalcLengthOfCubicBezier(aState.pos, cp1, cp2, to);
    aState.cp2 = cp2;
    aState.cp1 = to;
  }
  aState.pos = to;
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:13,代码来源:SVGPathSegUtils.cpp

示例10: TraverseArcRel

static void
TraverseArcRel(const float* aArgs, SVGPathTraversalState& aState)
{
  Point to = aState.pos + Point(aArgs[5], aArgs[6]);
  if (aState.ShouldUpdateLengthAndControlPoints()) {
    float dist = 0;
    Point radii(aArgs[0], aArgs[1]);
    Point bez[4] = { aState.pos, Point(0, 0), Point(0, 0), Point(0, 0) };
    nsSVGArcConverter converter(aState.pos, to, radii, aArgs[2],
                                aArgs[3] != 0, aArgs[4] != 0);
    while (converter.GetNextSegment(&bez[1], &bez[2], &bez[3])) {
      dist += CalcBezLengthHelper(bez, 4, 0, SplitCubicBezier);
      bez[0] = bez[3];
    }
    aState.length += dist;
    aState.cp1 = aState.cp2 = to;
  }
  aState.pos = to;
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:19,代码来源:SVGPathSegUtils.cpp


注:本文中的SVGPathTraversalState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。