本文整理汇总了C++中SkRegion::intersects方法的典型用法代码示例。如果您正苦于以下问题:C++ SkRegion::intersects方法的具体用法?C++ SkRegion::intersects怎么用?C++ SkRegion::intersects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkRegion
的用法示例。
在下文中一共展示了SkRegion::intersects方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawPredicates
void drawPredicates(SkCanvas* canvas, const SkPoint pts[]) {
SkRegion rgn;
build_base_rgn(&rgn);
drawstr(canvas, "Intersects", pts[0], rgn.intersects(fRect));
drawstr(canvas, "Contains", pts[1], rgn.contains(fRect));
}
示例2: sectsrect_proc
static bool sectsrect_proc(SkRegion& a, SkRegion& b) {
SkIRect r = a.getBounds();
r.inset(r.width()/4, r.height()/4);
return a.intersects(r);
}
示例3: sectsrgn_proc
static bool sectsrgn_proc(SkRegion& a, SkRegion& b) {
return a.intersects(b);
}
示例4: drawRegion
void GLExtras::drawRegion(const SkRegion& region, bool fill, bool drawBorder,
const TransformationMatrix* drawMat, Color color)
{
if (region.isEmpty())
return;
if (fill) {
SkRegion::Iterator rgnIter(region);
while (!rgnIter.done()) {
const SkIRect& ir = rgnIter.rect();
SkRect r;
r.set(ir.fLeft, ir.fTop, ir.fRight, ir.fBottom);
drawRing(r, color, drawMat);
rgnIter.next();
}
}
if (fill && !drawBorder)
return;
SkPath path;
if (!region.getBoundaryPath(&path))
return;
SkPath::Iter iter(path, true);
SkPath::Verb verb;
SkPoint pts[4];
SkRegion clip;
SkIRect startRect;
while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
if (verb == SkPath::kLine_Verb) {
SkRect r;
r.set(pts, 2);
SkIRect line;
int borderWidth = RING_BORDER_WIDTH;
if (!fill)
borderWidth *= 2;
line.fLeft = r.fLeft - borderWidth;
line.fRight = r.fRight + borderWidth;
line.fTop = r.fTop - borderWidth;
line.fBottom = r.fBottom + borderWidth;
if (clip.intersects(line)) {
clip.op(line, SkRegion::kReverseDifference_Op);
if (clip.isEmpty())
continue; // Nothing to draw, continue
line = clip.getBounds();
if (SkIRect::Intersects(startRect, line)) {
clip.op(startRect, SkRegion::kDifference_Op);
if (clip.isEmpty())
continue; // Nothing to draw, continue
line = clip.getBounds();
}
} else {
clip.setRect(line);
}
r.set(line.fLeft, line.fTop, line.fRight, line.fBottom);
drawRing(r, color, drawMat);
if (startRect.isEmpty()) {
startRect.set(line.fLeft, line.fTop, line.fRight, line.fBottom);
}
}
if (verb == SkPath::kMove_Verb) {
startRect.setEmpty();
}
}
}