本文整理汇总了C++中DashArray::end方法的典型用法代码示例。如果您正苦于以下问题:C++ DashArray::end方法的具体用法?C++ DashArray::end怎么用?C++ DashArray::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DashArray
的用法示例。
在下文中一共展示了DashArray::end方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: translateIntersectionPointsToSkipInkBoundaries
static DashArray translateIntersectionPointsToSkipInkBoundaries(const DashArray& intersections, float dilationAmount, float totalWidth)
{
ASSERT(!(intersections.size() % 2));
// Step 1: Make pairs so we can sort based on range starting-point. We dilate the ranges in this step as well.
Vector<std::pair<float, float>> tuples;
for (auto i = intersections.begin(); i != intersections.end(); i++, i++)
tuples.append(std::make_pair(*i - dilationAmount, *(i + 1) + dilationAmount));
std::sort(tuples.begin(), tuples.end(), &compareTuples);
// Step 2: Deal with intersecting ranges.
Vector<std::pair<float, float>> intermediateTuples;
if (tuples.size() >= 2) {
intermediateTuples.append(*tuples.begin());
for (auto i = tuples.begin() + 1; i != tuples.end(); i++) {
float& firstEnd = intermediateTuples.last().second;
float secondStart = i->first;
float secondEnd = i->second;
if (secondStart <= firstEnd && secondEnd <= firstEnd) {
// Ignore this range completely
} else if (secondStart <= firstEnd)
firstEnd = secondEnd;
else
intermediateTuples.append(*i);
}
} else
intermediateTuples = tuples;
// Step 3: Output the space between the ranges, but only if the space warrants an underline.
float previous = 0;
DashArray result;
for (const auto& tuple : intermediateTuples) {
if (tuple.first - previous > dilationAmount) {
result.append(previous);
result.append(tuple.first);
}
previous = tuple.second;
}
if (totalWidth - previous > dilationAmount) {
result.append(previous);
result.append(totalWidth);
}
return result;
}