本文整理汇总了C++中SkRegion::getBoundaryPath方法的典型用法代码示例。如果您正苦于以下问题:C++ SkRegion::getBoundaryPath方法的具体用法?C++ SkRegion::getBoundaryPath怎么用?C++ SkRegion::getBoundaryPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkRegion
的用法示例。
在下文中一共展示了SkRegion::getBoundaryPath方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintContents
void DefaultTapHighlight::paintContents(const GraphicsLayer*, GraphicsContext& c, GraphicsLayerPaintingPhase, const IntRect& /*inClip*/)
{
std::vector<Platform::IntRect> rects = m_region.rects();
Platform::IntRect rect = m_region.extents();
SkRegion overlayRegion;
unsigned rectCount = m_region.numRects();
if (!rectCount)
return;
for (unsigned i = 0; i < rectCount; ++i) {
Platform::IntRect rectToPaint = rects[i];
SkIRect r = SkIRect::MakeXYWH(rectToPaint.x(), rectToPaint.y(), rectToPaint.width(), rectToPaint.height());
overlayRegion.op(r, SkRegion::kUnion_Op);
}
SkPath pathToPaint;
overlayRegion.getBoundaryPath(&pathToPaint);
Path path(pathToPaint);
c.save();
c.translate(-rect.x(), -rect.y());
// Draw tap highlight
c.setFillColor(m_color, ColorSpaceDeviceRGB);
c.fillPath(path);
Color darker = Color(m_color.red(), m_color.green(), m_color.blue()); // Get rid of alpha.
c.setStrokeColor(darker, ColorSpaceDeviceRGB);
c.setStrokeThickness(1);
c.strokePath(path);
c.restore();
}
示例2: drawFocusRing
void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color)
{
if (paintingDisabled())
return;
unsigned rectCount = rects.size();
if (!rectCount)
return;
SkRegion focusRingRegion;
const int focusRingOutset = getFocusRingOutset(offset);
for (unsigned i = 0; i < rectCount; i++) {
SkIRect r = rects[i];
r.inset(-focusRingOutset, -focusRingOutset);
focusRingRegion.op(r, SkRegion::kUnion_Op);
}
SkPath path;
SkPaint paint;
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
paint.setColor(color.rgb());
focusRingRegion.getBoundaryPath(&path);
drawOuterPath(platformContext(), path, paint, width);
drawInnerPath(platformContext(), path, paint, width);
}
示例3: drawFocusRing
void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int /* width */, int /* offset */, const Color& color)
{
if (paintingDisabled())
return;
unsigned rectCount = rects.size();
if (!rectCount)
return;
SkRegion focusRingRegion;
const SkScalar focusRingOutset = WebCoreFloatToSkScalar(0.5);
for (unsigned i = 0; i < rectCount; i++) {
SkIRect r = rects[i];
r.inset(-focusRingOutset, -focusRingOutset);
focusRingRegion.op(r, SkRegion::kUnion_Op);
}
SkPath path;
SkPaint paint;
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
paint.setColor(color.rgb());
paint.setStrokeWidth(focusRingOutset * 2);
paint.setPathEffect(new SkCornerPathEffect(focusRingOutset * 2))->unref();
focusRingRegion.getBoundaryPath(&path);
platformContext()->canvas()->drawPath(path, paint);
}
示例4: setMatrixClip
void SkPDFDevice::setMatrixClip(const SkMatrix& matrix,
const SkRegion& region,
const SkClipStack&) {
// See the comment in the header file above GraphicStackEntry.
if (region != fGraphicStack[fGraphicStackIndex].fClip) {
while (fGraphicStackIndex > 0)
popGS();
pushGS();
SkPath clipPath;
if (region.getBoundaryPath(&clipPath)) {
SkPDFUtils::EmitPath(clipPath, &fContent);
SkPath::FillType clipFill = clipPath.getFillType();
NOT_IMPLEMENTED(clipFill == SkPath::kInverseEvenOdd_FillType,
false);
NOT_IMPLEMENTED(clipFill == SkPath::kInverseWinding_FillType,
false);
if (clipFill == SkPath::kEvenOdd_FillType)
fContent.writeText("W* n ");
else
fContent.writeText("W n ");
}
fGraphicStack[fGraphicStackIndex].fClip = region;
}
setTransform(matrix);
}
示例5: drawRegion
void SkBaseDevice::drawRegion(const SkDraw& draw, const SkRegion& region, const SkPaint& paint) {
bool isNonTranslate = draw.fMatrix->getType() & ~(SkMatrix::kTranslate_Mask);
bool complexPaint = paint.getStyle() != SkPaint::kFill_Style || paint.getMaskFilter() ||
paint.getPathEffect();
bool antiAlias = paint.isAntiAlias() && (!is_int(draw.fMatrix->getTranslateX()) ||
!is_int(draw.fMatrix->getTranslateY()));
if (isNonTranslate || complexPaint || antiAlias) {
SkPath path;
region.getBoundaryPath(&path);
return this->drawPath(draw, path, paint, nullptr, false);
}
SkRegion::Iterator it(region);
while (!it.done()) {
this->drawRect(draw, SkRect::Make(it.rect()), paint);
it.next();
}
}
示例6: drawPathOped
void drawPathOped(SkCanvas* canvas, SkRegion::Op op, SkColor color) {
SkRegion rgn;
SkPath path;
this->build_rgn(&rgn, op);
rgn.getBoundaryPath(&path);
this->drawOrig(canvas, true);
SkPaint paint;
paint.setStyle(SkPaint::kFill_Style);
paint.setColor((color & ~(0xFF << 24)) | (0x44 << 24));
canvas->drawPath(path, paint);
paint.setColor(color);
paint.setStyle(SkPaint::kStroke_Style);
canvas->drawPath(path, paint);
}
示例7: draw
void CursorRing::draw(SkCanvas* canvas, LayerAndroid* layer)
{
#if USE(ACCELERATED_COMPOSITING)
int layerId = m_node->isInLayer() ? m_frame->layer(m_node)->uniqueId() : -1;
if (layer->uniqueId() != layerId)
return;
#endif
if (canvas->quickReject(m_bounds, SkCanvas::kAA_EdgeType)) {
DBG_NAV_LOGD("canvas->quickReject cursorNode=%d (nodePointer=%p)"
" bounds=(%d,%d,w=%d,h=%d)", m_node->index(), m_node->nodePointer(),
m_bounds.x(), m_bounds.y(), m_bounds.width(), m_bounds.height());
m_followedLink = false;
return;
}
unsigned rectCount = m_rings.size();
SkRegion rgn;
SkPath path;
for (unsigned i = 0; i < rectCount; i++)
{
SkRect r(m_rings[i]);
SkIRect ir;
r.round(&ir);
ir.inset(-CURSOR_RING_OUTER_OUTSET, -CURSOR_RING_OUTER_OUTSET);
rgn.op(ir, SkRegion::kUnion_Op);
}
rgn.getBoundaryPath(&path);
SkPaint paint;
paint.setAntiAlias(true);
paint.setPathEffect(new SkCornerPathEffect(CURSOR_RING_ROUNDEDNESS))->unref();
if (m_flavor >= NORMAL_ANIMATING) { // pressed
paint.setColor(cursorPressedColors[m_flavor - NORMAL_ANIMATING]);
canvas->drawPath(path, paint);
}
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(CURSOR_RING_OUTER_DIAMETER);
paint.setColor(cursorOuterColors[m_flavor]);
canvas->drawPath(path, paint);
paint.setStrokeWidth(CURSOR_RING_INNER_DIAMETER);
paint.setColor(cursorInnerColors[m_flavor]);
canvas->drawPath(path, paint);
}
示例8: 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();
}
}
}