本文整理汇总了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;
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}