本文整理汇总了C++中SkVector::rotateCW方法的典型用法代码示例。如果您正苦于以下问题:C++ SkVector::rotateCW方法的具体用法?C++ SkVector::rotateCW怎么用?C++ SkVector::rotateCW使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkVector
的用法示例。
在下文中一共展示了SkVector::rotateCW方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calc_dash_scaling
static void calc_dash_scaling(SkScalar* parallelScale, SkScalar* perpScale,
const SkMatrix& viewMatrix, const SkPoint pts[2]) {
SkVector vecSrc = pts[1] - pts[0];
SkScalar magSrc = vecSrc.length();
SkScalar invSrc = magSrc ? SkScalarInvert(magSrc) : 0;
vecSrc.scale(invSrc);
SkVector vecSrcPerp;
vecSrc.rotateCW(&vecSrcPerp);
viewMatrix.mapVectors(&vecSrc, 1);
viewMatrix.mapVectors(&vecSrcPerp, 1);
// parallelScale tells how much to scale along the line parallel to the dash line
// perpScale tells how much to scale in the direction perpendicular to the dash line
*parallelScale = vecSrc.length();
*perpScale = vecSrcPerp.length();
}
示例2: SquareCapper
static void SquareCapper(SkPath* path, const SkPoint& pivot,
const SkVector& normal, const SkPoint& stop,
SkPath* otherPath)
{
SkVector parallel;
normal.rotateCW(¶llel);
if (otherPath)
{
path->setLastPt(pivot.fX + normal.fX + parallel.fX, pivot.fY + normal.fY + parallel.fY);
path->lineTo(pivot.fX - normal.fX + parallel.fX, pivot.fY - normal.fY + parallel.fY);
}
else
{
path->lineTo(pivot.fX + normal.fX + parallel.fX, pivot.fY + normal.fY + parallel.fY);
path->lineTo(pivot.fX - normal.fX + parallel.fX, pivot.fY - normal.fY + parallel.fY);
path->lineTo(stop.fX, stop.fY);
}
}