本文整理汇总了C++中SkPath::addRRect方法的典型用法代码示例。如果您正苦于以下问题:C++ SkPath::addRRect方法的具体用法?C++ SkPath::addRRect怎么用?C++ SkPath::addRRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkPath
的用法示例。
在下文中一共展示了SkPath::addRRect方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawRRect
void SkSVGDevice::drawRRect(const SkDraw& draw, const SkRRect& rr, const SkPaint& paint) {
SkPath path;
path.addRRect(rr);
AutoElement elem("path", fWriter, fResourceBucket, draw, paint);
elem.addPathAttributes(path);
}
示例2: drawRRect
void SkBitmapDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint& paint) {
CHECK_FOR_NODRAW_ANNOTATION(paint);
SkPath path;
path.addRRect(rrect);
// call the VIRTUAL version, so any subclasses who do handle drawPath aren't
// required to override drawRRect.
this->drawPath(draw, path, paint, NULL, true);
}
示例3: op
bool SkRasterClip::op(const SkRRect& rrect, const SkMatrix& matrix, const SkIRect& devBounds,
SkRegion::Op op, bool doAA) {
SkIRect bounds(devBounds);
this->applyClipRestriction(op, &bounds);
SkPath path;
path.addRRect(rrect);
return this->op(path, matrix, bounds, op, doAA);
}
示例4: drawDRRect
void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
const SkRRect& inner, const SkPaint& paint) {
SkPath path;
path.addRRect(outer);
path.addRRect(inner);
path.setFillType(SkPath::kEvenOdd_FillType);
const SkMatrix* preMatrix = nullptr;
const bool pathIsMutable = true;
this->drawPath(draw, path, paint, preMatrix, pathIsMutable);
}
示例5: op
bool SkRasterClip::op(const SkRRect& rrect, const SkMatrix& matrix, const SkIRect& bounds,
SkRegion::Op op, bool doAA) {
if (fForceConservativeRects) {
return this->op(rrect.getBounds(), matrix, bounds, op, doAA);
}
SkPath path;
path.addRRect(rrect);
return this->op(path, matrix, bounds, op, doAA);
}
示例6: drawRRect
void SkBitmapDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint& paint) {
#ifdef SK_IGNORE_BLURRED_RRECT_OPT
SkPath path;
path.addRRect(rrect);
// call the VIRTUAL version, so any subclasses who do handle drawPath aren't
// required to override drawRRect.
this->drawPath(draw, path, paint, nullptr, true);
#else
draw.drawRRect(rrect, paint);
#endif
}
示例7: inner_path_contains_rrect
static SkRRect inner_path_contains_rrect(skiatest::Reporter* reporter, const SkRRect& in) {
switch (in.getType()) {
case SkRRect::kEmpty_Type:
case SkRRect::kRect_Type:
case SkRRect::kOval_Type:
return in;
default:
break;
}
SkPath path;
path.addRRect(in);
return path_contains_rrect(reporter, path);
}
示例8: test_really_a_rect
static void test_really_a_rect(skiatest::Reporter* reporter) {
SkRRect rrect;
rrect.setRectXY(SkRect::MakeWH(100, 100), 5, 5);
SkPath path;
path.addRRect(rrect);
SkAAClip clip;
clip.setPath(path);
REPORTER_ASSERT(reporter, clip.getBounds() == SkIRect::MakeWH(100, 100));
REPORTER_ASSERT(reporter, !clip.isRect());
// This rect should intersect the clip, but slice-out all of the "soft" parts,
// leaving just a rect.
const SkIRect ir = SkIRect::MakeLTRB(10, -10, 50, 90);
clip.op(ir, SkRegion::kIntersect_Op);
REPORTER_ASSERT(reporter, clip.getBounds() == SkIRect::MakeLTRB(10, 0, 50, 90));
// the clip recognized that that it is just a rect!
REPORTER_ASSERT(reporter, clip.isRect());
}
示例9: onOnceBeforeDraw
void onOnceBeforeDraw() override {
fRRectPath.addRRect(SkRRect::MakeRectXY(SkRect::MakeXYWH(-130, -128.5, 130, 128.5), 4, 4));
fReferenceImage = GetResourceAsImage("shadowreference.png");
}
示例10: makePath
SkPath makePath() {
SkPath path;
for (uint32_t cIndex = 0; cIndex < fPathContourCount; ++cIndex) {
uint32_t segments = makeSegmentCount();
for (uint32_t sIndex = 0; sIndex < segments; ++sIndex) {
RandomAddPath addPathType = makeAddPathType();
++fAddCount;
if (fPrintName) {
SkDebugf("%.*s%s\n", fPathDepth * 3, fTab,
gRandomAddPathNames[addPathType]);
}
switch (addPathType) {
case kAddArc: {
SkRect oval = makeRect();
SkScalar startAngle = makeAngle();
SkScalar sweepAngle = makeAngle();
path.addArc(oval, startAngle, sweepAngle);
validate(path);
} break;
case kAddRoundRect1: {
SkRect rect = makeRect();
SkScalar rx = makeScalar(), ry = makeScalar();
SkPath::Direction dir = makeDirection();
path.addRoundRect(rect, rx, ry, dir);
validate(path);
} break;
case kAddRoundRect2: {
SkRect rect = makeRect();
SkScalar radii[8];
makeScalarArray(SK_ARRAY_COUNT(radii), radii);
SkPath::Direction dir = makeDirection();
path.addRoundRect(rect, radii, dir);
validate(path);
} break;
case kAddRRect: {
SkRRect rrect = makeRRect();
SkPath::Direction dir = makeDirection();
path.addRRect(rrect, dir);
validate(path);
} break;
case kAddPoly: {
SkTDArray<SkPoint> points;
makePointArray(&points);
bool close = makeBool();
path.addPoly(&points[0], points.count(), close);
validate(path);
} break;
case kAddPath1:
if (fPathDepth < fPathDepthLimit) {
++fPathDepth;
SkPath src = makePath();
validate(src);
SkScalar dx = makeScalar();
SkScalar dy = makeScalar();
SkPath::AddPathMode mode = makeAddPathMode();
path.addPath(src, dx, dy, mode);
--fPathDepth;
validate(path);
}
break;
case kAddPath2:
if (fPathDepth < fPathDepthLimit) {
++fPathDepth;
SkPath src = makePath();
validate(src);
SkPath::AddPathMode mode = makeAddPathMode();
path.addPath(src, mode);
--fPathDepth;
validate(path);
}
break;
case kAddPath3:
if (fPathDepth < fPathDepthLimit) {
++fPathDepth;
SkPath src = makePath();
validate(src);
SkMatrix matrix = makeMatrix();
SkPath::AddPathMode mode = makeAddPathMode();
path.addPath(src, matrix, mode);
--fPathDepth;
validate(path);
}
break;
case kReverseAddPath:
if (fPathDepth < fPathDepthLimit) {
++fPathDepth;
SkPath src = makePath();
validate(src);
path.reverseAddPath(src);
--fPathDepth;
validate(path);
}
break;
case kMoveToPath: {
SkScalar x = makeScalar();
SkScalar y = makeScalar();
path.moveTo(x, y);
validate(path);
} break;
case kRMoveToPath: {
//.........这里部分代码省略.........
示例11: onDrawContent
void onDrawContent(SkCanvas* canvas) override {
SkPath path;
SkScalar width = fWidth;
if (fCubicButton.fEnabled) {
path.moveTo(fPts[0]);
path.cubicTo(fPts[1], fPts[2], fPts[3]);
setForGeometry();
draw_stroke(canvas, path, width, 950, false);
}
if (fConicButton.fEnabled) {
path.moveTo(fPts[4]);
path.conicTo(fPts[5], fPts[6], fWeight);
setForGeometry();
draw_stroke(canvas, path, width, 950, false);
}
if (fQuadButton.fEnabled) {
path.reset();
path.moveTo(fPts[7]);
path.quadTo(fPts[8], fPts[9]);
setForGeometry();
draw_stroke(canvas, path, width, 950, false);
}
if (fRRectButton.fEnabled) {
SkScalar rad = 32;
SkRect r;
r.set(&fPts[10], 2);
path.reset();
SkRRect rr;
rr.setRectXY(r, rad, rad);
path.addRRect(rr);
setForGeometry();
draw_stroke(canvas, path, width, 950, false);
path.reset();
SkRRect rr2;
rr.inset(width/2, width/2, &rr2);
path.addRRect(rr2, SkPath::kCCW_Direction);
rr.inset(-width/2, -width/2, &rr2);
path.addRRect(rr2, SkPath::kCW_Direction);
SkPaint paint;
paint.setAntiAlias(true);
paint.setColor(0x40FF8844);
canvas->drawPath(path, paint);
}
if (fCircleButton.fEnabled) {
path.reset();
SkRect r;
r.set(&fPts[12], 2);
path.addOval(r);
setForGeometry();
if (fCircleButton.fFill) {
draw_fill(canvas, r, width);
} else {
draw_stroke(canvas, path, width, 950, false);
}
}
if (fTextButton.fEnabled) {
path.reset();
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(fTextSize);
paint.getTextPath(fText.c_str(), fText.size(), 0, fTextSize, &path);
setForText();
draw_stroke(canvas, path, width * fWidthScale / fTextSize, fTextSize, true);
}
if (fAnimate) {
fWidth += fDWidth;
if (fDWidth > 0 && fWidth > kWidthMax) {
fDWidth = -fDWidth;
} else if (fDWidth < 0 && fWidth < kWidthMin) {
fDWidth = -fDWidth;
}
}
setAsNeeded();
if (fConicButton.fEnabled) {
draw_control(canvas, fWeightControl, fWeight, 0, 5, "weight");
}
#ifdef SK_DEBUG
draw_control(canvas, fErrorControl, gDebugStrokerError, kStrokerErrorMin, kStrokerErrorMax,
"error");
#endif
draw_control(canvas, fWidthControl, fWidth * fWidthScale, kWidthMin * fWidthScale,
kWidthMax * fWidthScale, "width");
draw_button(canvas, fQuadButton);
draw_button(canvas, fCubicButton);
draw_button(canvas, fConicButton);
draw_button(canvas, fRRectButton);
draw_button(canvas, fCircleButton);
draw_button(canvas, fTextButton);
this->inval(NULL);
}
示例12: onAsPath
SkPath RRect::onAsPath() const {
SkPath path;
path.addRRect(fRRect, this->getDirection(), this->getInitialPointIndex());
return path;
}