本文整理汇总了C++中SkRRect::inset方法的典型用法代码示例。如果您正苦于以下问题:C++ SkRRect::inset方法的具体用法?C++ SkRRect::inset怎么用?C++ SkRRect::inset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkRRect
的用法示例。
在下文中一共展示了SkRRect::inset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw_drrect
static void draw_drrect(SkCanvas* canvas, const SkRect& r, const SkPaint& p) {
SkScalar xRad = r.width() / 4.0f;
SkScalar yRad = r.height() / 4.0f;
SkRRect outer;
outer.setRectXY(r, xRad, yRad);
SkRRect inner = outer;
inner.inset(xRad, yRad);
canvas->drawDRRect(outer, inner, p);
}
示例2: 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);
}