本文整理汇总了C++中SegmentList::append方法的典型用法代码示例。如果您正苦于以下问题:C++ SegmentList::append方法的具体用法?C++ SegmentList::append怎么用?C++ SegmentList::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SegmentList
的用法示例。
在下文中一共展示了SegmentList::append方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getIncludedIntervals
void BoxShape::getIncludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHeight, SegmentList& result) const
{
const FloatRoundedRect& paddingBounds = shapePaddingBounds();
if (paddingBounds.isEmpty())
return;
const FloatRect& rect = paddingBounds.rect();
float y1 = logicalTop;
float y2 = logicalTop + logicalHeight;
if (y1 < rect.y() || y2 > rect.maxY())
return;
if (!paddingBounds.isRounded()) {
result.append(LineSegment(rect.x(), rect.maxX()));
return;
}
float x1 = rect.x();
float x2 = rect.maxX();
float minXIntercept;
float maxXIntercept;
if (paddingBounds.xInterceptsAtY(y1, minXIntercept, maxXIntercept)) {
x1 = std::max<float>(x1, minXIntercept);
x2 = std::min<float>(x2, maxXIntercept);
}
if (paddingBounds.xInterceptsAtY(y2, minXIntercept, maxXIntercept)) {
x1 = std::max<float>(x1, minXIntercept);
x2 = std::min<float>(x2, maxXIntercept);
}
result.append(LineSegment(x1, x2));
}
示例2: getIncludedIntervals
void ExclusionPolygon::getIncludedIntervals(float logicalTop, float logicalHeight, SegmentList& result) const
{
if (isEmpty())
return;
float y1 = minYForLogicalLine(logicalTop, logicalHeight);
float y2 = maxYForLogicalLine(logicalTop, logicalHeight);
Vector<ExclusionInterval> y1XIntervals, y2XIntervals;
computeXIntersections(y1, true, y1XIntervals);
computeXIntersections(y2, false, y2XIntervals);
Vector<ExclusionInterval> commonIntervals;
intersectExclusionIntervals(y1XIntervals, y2XIntervals, commonIntervals);
Vector<ExclusionInterval> edgeIntervals;
computeEdgeIntersections(y1, y2, edgeIntervals);
Vector<ExclusionInterval> includedIntervals;
subtractExclusionIntervals(commonIntervals, edgeIntervals, includedIntervals);
for (unsigned i = 0; i < includedIntervals.size(); i++) {
ExclusionInterval interval = includedIntervals[i];
result.append(LineSegment(interval.x1, interval.x2));
}
}
示例3: getExcludedIntervals
void RectangleShape::getExcludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHeight, SegmentList& result) const
{
const FloatRoundedRect& bounds = shapeMarginBounds();
if (bounds.isEmpty())
return;
float y1 = logicalTop;
float y2 = logicalTop + logicalHeight;
if (y2 < bounds.y() || y1 >= bounds.maxY())
return;
float x1 = bounds.x();
float x2 = bounds.maxX();
if (bounds.ry() > 0) {
if (y2 < bounds.y() + bounds.ry()) {
float yi = y2 - bounds.y() - bounds.ry();
float xi = ellipseXIntercept(yi, bounds.rx(), bounds.ry());
x1 = bounds.x() + bounds.rx() - xi;
x2 = bounds.maxX() - bounds.rx() + xi;
} else if (y1 > bounds.maxY() - bounds.ry()) {
float yi = y1 - (bounds.maxY() - bounds.ry());
float xi = ellipseXIntercept(yi, bounds.rx(), bounds.ry());
x1 = bounds.x() + bounds.rx() - xi;
x2 = bounds.maxX() - bounds.rx() + xi;
}
}
result.append(LineSegment(x1, x2));
}
示例4: getExcludedIntervals
void ExclusionRectangle::getExcludedIntervals(float logicalTop, float logicalBottom, SegmentList& result) const
{
float y1 = minYForLogicalLine(logicalTop, logicalBottom);
float y2 = maxYForLogicalLine(logicalTop, logicalBottom);
if (y2 < m_y || y1 >= m_y + m_height)
return;
float x1 = m_x;
float x2 = m_x + m_width;
if (m_ry > 0) {
if (y2 < m_y + m_ry) {
float yi = y2 - m_y - m_ry;
float xi = ellipseXIntercept(yi, m_rx, m_ry);
x1 = m_x + m_rx - xi;
x2 = m_x + m_width - m_rx + xi;
} else if (y1 > m_y + m_height - m_ry) {
float yi = y1 - (m_y + m_height - m_ry);
float xi = ellipseXIntercept(yi, m_rx, m_ry);
x1 = m_x + m_rx - xi;
x2 = m_x + m_width - m_rx + xi;
}
}
result.append(LineSegment(x1, x2));
}
示例5: getExcludedIntervals
void BoxShape::getExcludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHeight, SegmentList& result) const
{
const FloatRoundedRect& marginBounds = shapeMarginBounds();
if (marginBounds.isEmpty() || !lineOverlapsShapeMarginBounds(logicalTop, logicalHeight))
return;
float y1 = logicalTop;
float y2 = logicalTop + logicalHeight;
const FloatRect& rect = marginBounds.rect();
if (!marginBounds.isRounded()) {
result.append(LineSegment(rect.x(), rect.maxX()));
return;
}
float topCornerMaxY = std::max<float>(marginBounds.topLeftCorner().maxY(), marginBounds.topRightCorner().maxY());
float bottomCornerMinY = std::min<float>(marginBounds.bottomLeftCorner().y(), marginBounds.bottomRightCorner().y());
if (y1 <= topCornerMaxY && y2 >= bottomCornerMinY) {
result.append(LineSegment(rect.x(), rect.maxX()));
return;
}
float x1 = rect.maxX();
float x2 = rect.x();
float minXIntercept;
float maxXIntercept;
if (marginBounds.xInterceptsAtY(y1, minXIntercept, maxXIntercept)) {
x1 = std::min<float>(x1, minXIntercept);
x2 = std::max<float>(x2, maxXIntercept);
}
if (marginBounds.xInterceptsAtY(y2, minXIntercept, maxXIntercept)) {
x1 = std::min<float>(x1, minXIntercept);
x2 = std::max<float>(x2, maxXIntercept);
}
ASSERT(x2 >= x1);
result.append(LineSegment(x1, x2));
}
示例6: getIncludedIntervals
void RectangleShape::getIncludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHeight, SegmentList& result) const
{
const FloatRoundedRect& bounds = shapePaddingBounds();
if (bounds.isEmpty())
return;
float y1 = logicalTop;
float y2 = logicalTop + logicalHeight;
if (y1 < bounds.y() || y2 > bounds.maxY())
return;
float x1 = bounds.x();
float x2 = bounds.maxX();
if (bounds.ry() > 0) {
bool y1InterceptsCorner = y1 < bounds.y() + bounds.ry();
bool y2InterceptsCorner = y2 > bounds.maxY() - bounds.ry();
float xi = 0;
if (y1InterceptsCorner && y2InterceptsCorner) {
if (y1 < bounds.height() + 2 * bounds.y() - y2) {
float yi = y1 - bounds.y() - bounds.ry();
xi = ellipseXIntercept(yi, bounds.rx(), bounds.ry());
} else {
float yi = y2 - (bounds.maxY() - bounds.ry());
xi = ellipseXIntercept(yi, bounds.rx(), bounds.ry());
}
} else if (y1InterceptsCorner) {
float yi = y1 - bounds.y() - bounds.ry();
xi = ellipseXIntercept(yi, bounds.rx(), bounds.ry());
} else if (y2InterceptsCorner) {
float yi = y2 - (bounds.maxY() - bounds.ry());
xi = ellipseXIntercept(yi, bounds.rx(), bounds.ry());
}
if (y1InterceptsCorner || y2InterceptsCorner) {
x1 = bounds.x() + bounds.rx() - xi;
x2 = bounds.maxX() - bounds.rx() + xi;
}
}
result.append(LineSegment(x1, x2));
}
示例7: getIncludedIntervals
void ExclusionRectangle::getIncludedIntervals(float logicalTop, float logicalBottom, SegmentList& result) const
{
float y1 = minYForLogicalLine(logicalTop, logicalBottom);
float y2 = maxYForLogicalLine(logicalTop, logicalBottom);
if (y1 < m_y || y2 > m_y + m_height)
return;
float x1 = m_x;
float x2 = m_x + m_width;
if (m_ry > 0) {
bool y1InterceptsCorner = y1 < m_y + m_ry;
bool y2InterceptsCorner = y2 > m_y + m_height - m_ry;
float xi = 0;
if (y1InterceptsCorner && y2InterceptsCorner) {
if (y1 < m_height + 2*m_y - y2) {
float yi = y1 - m_y - m_ry;
xi = ellipseXIntercept(yi, m_rx, m_ry);
} else {
float yi = y2 - (m_y + m_height - m_ry);
xi = ellipseXIntercept(yi, m_rx, m_ry);
}
} else if (y1InterceptsCorner) {
float yi = y1 - m_y - m_ry;
xi = ellipseXIntercept(yi, m_rx, m_ry);
} else if (y2InterceptsCorner) {
float yi = y2 - (m_y + m_height - m_ry);
xi = ellipseXIntercept(yi, m_rx, m_ry);
}
if (y1InterceptsCorner || y2InterceptsCorner) {
x1 = m_x + m_rx - xi;
x2 = m_x + m_width - m_rx + xi;
}
}
result.append(LineSegment(x1, x2));
}
示例8: getExcludedIntervals
void RasterShape::getExcludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHeight, SegmentList& result) const
{
const RasterShapeIntervals& intervals = marginIntervals();
if (intervals.isEmpty())
return;
int y1 = logicalTop;
int y2 = logicalTop + logicalHeight;
ASSERT(y2 >= y1);
if (y2 < intervals.bounds().y() || y1 >= intervals.bounds().maxY())
return;
y1 = std::max(y1, intervals.bounds().y());
y2 = std::min(y2, intervals.bounds().maxY());
IntShapeInterval excludedInterval;
for (int y = y1; y < y2; y++)
excludedInterval.unite(intervals.intervalAt(y));
// Note: |marginIntervals()| returns end-point exclusive
// intervals. |excludedInterval.x2()| contains the left-most pixel
// offset to the right of the calculated union.
result.append(LineSegment(excludedInterval.x1(), excludedInterval.x2()));
}
示例9: appendLineSegments
static inline void appendLineSegments(const IntShapeIntervals& intervals, SegmentList& result)
{
for (unsigned i = 0; i < intervals.size(); i++)
result.append(LineSegment(intervals[i].x1(), intervals[i].x2() + 1));
}