本文整理汇总了C++中SkRRect类的典型用法代码示例。如果您正苦于以下问题:C++ SkRRect类的具体用法?C++ SkRRect怎么用?C++ SkRRect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SkRRect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
std::unique_ptr<GrFragmentProcessor> EllipticalRRectEffect::TestCreate(GrProcessorTestData* d) {
SkScalar w = d->fRandom->nextRangeScalar(20.f, 1000.f);
SkScalar h = d->fRandom->nextRangeScalar(20.f, 1000.f);
SkVector r[4];
r[SkRRect::kUpperLeft_Corner].fX = d->fRandom->nextRangeF(kRadiusMin, 9.f);
// ensure at least one corner really is elliptical
do {
r[SkRRect::kUpperLeft_Corner].fY = d->fRandom->nextRangeF(kRadiusMin, 9.f);
} while (r[SkRRect::kUpperLeft_Corner].fY == r[SkRRect::kUpperLeft_Corner].fX);
SkRRect rrect;
if (d->fRandom->nextBool()) {
// half the time create a four-radii rrect.
r[SkRRect::kLowerRight_Corner].fX = d->fRandom->nextRangeF(kRadiusMin, 9.f);
r[SkRRect::kLowerRight_Corner].fY = d->fRandom->nextRangeF(kRadiusMin, 9.f);
r[SkRRect::kUpperRight_Corner].fX = r[SkRRect::kLowerRight_Corner].fX;
r[SkRRect::kUpperRight_Corner].fY = r[SkRRect::kUpperLeft_Corner].fY;
r[SkRRect::kLowerLeft_Corner].fX = r[SkRRect::kUpperLeft_Corner].fX;
r[SkRRect::kLowerLeft_Corner].fY = r[SkRRect::kLowerRight_Corner].fY;
rrect.setRectRadii(SkRect::MakeWH(w, h), r);
} else {
rrect.setRectXY(SkRect::MakeWH(w, h), r[SkRRect::kUpperLeft_Corner].fX,
r[SkRRect::kUpperLeft_Corner].fY);
}
std::unique_ptr<GrFragmentProcessor> fp;
do {
GrClipEdgeType et = (GrClipEdgeType)d->fRandom->nextULessThan(kGrClipEdgeTypeCnt);
fp = GrRRectEffect::Make(et, rrect, *d->caps()->shaderCaps());
} while (nullptr == fp);
return fp;
}
示例2: test_tricky_radii_crbug_458522
static void test_tricky_radii_crbug_458522(skiatest::Reporter* reporter) {
SkRRect rr;
const SkRect bounds = { 3709, 3709, 3709 + 7402, 3709 + 29825 };
const SkScalar rad = 12814;
const SkVector vec[] = { { rad, rad }, { 0, rad }, { rad, rad }, { 0, rad } };
rr.setRectRadii(bounds, vec);
}
示例3: emit_draw
static void emit_draw(SkCanvas* canvas, DrawOpType draw, SkTDArray<DrawType>* expected) {
switch (draw) {
case kNone_DrawOpType:
break;
case kClear_DrawOpType:
canvas->clear(SK_ColorRED);
*expected->append() = DRAW_CLEAR;
break;
case kOval_DrawOpType: {
SkRect r = SkRect::MakeLTRB(10, 10, 90, 90);
SkPaint p;
canvas->drawOval(r, p);
*expected->append() = DRAW_OVAL;
break;
}
case kRect_DrawOpType: {
SkRect r = SkRect::MakeLTRB(10, 10, 90, 90);
SkPaint p;
canvas->drawRect(r, p);
*expected->append() = DRAW_RECT;
break;
}
case kRRect_DrawOpType: {
SkRect r = SkRect::MakeLTRB(10.0f, 10.0f, 90.0f, 90.0f);
SkRRect rr;
rr.setRectXY(r, 5.0f, 5.0f);
SkPaint p;
canvas->drawRRect(rr, p);
*expected->append() = DRAW_RRECT;
break;
}
default:
SkASSERT(0);
}
}
示例4: onDrawRRect
void SkDeferredCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
SkRect modRect = rrect.getBounds();
this->flush_check(&modRect, &paint, kNoClip_Flag);
fCanvas->drawRRect(make_offset(rrect,
modRect.x() - rrect.getBounds().x(),
modRect.y() - rrect.getBounds().y()), paint);
}
示例5: onDraw
void onDraw(SkCanvas* canvas) override {
canvas->scale(1.5f, 1.5f);
canvas->translate(50,50);
const float blurRadii[] = { 1,5,10,20 };
const int cornerRadii[] = { 1,5,10,20 };
const SkRect r = SkRect::MakeWH(SkIntToScalar(25), SkIntToScalar(25));
for (size_t i = 0; i < SK_ARRAY_COUNT(blurRadii); ++i) {
SkAutoCanvasRestore autoRestore(canvas, true);
canvas->translate(0, (r.height() + SkIntToScalar(50)) * i);
for (size_t j = 0; j < SK_ARRAY_COUNT(cornerRadii); ++j) {
for (int k = 0; k <= 1; k++) {
SkMaskFilter* filter = SkBlurMaskFilter::Create(
kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(blurRadii[i])),
SkBlurMaskFilter::kHighQuality_BlurFlag);
SkPaint paint;
paint.setColor(SK_ColorBLACK);
paint.setMaskFilter(filter)->unref();
bool useRadial = SkToBool(k);
if (useRadial) {
paint.setShader(MakeRadial());
}
SkRRect rrect;
rrect.setRectXY(r, SkIntToScalar(cornerRadii[j]),
SkIntToScalar(cornerRadii[j]));
canvas->drawRRect(rrect, paint);
canvas->translate(r.width() + SkIntToScalar(50), 0);
}
}
}
}
示例6: draw
SkRect draw(SkCanvas* canvas, const SkPaint& paint) override {
SkRRect outerRRect;
outerRRect.setRectXY(SkRect::MakeXYWH(0, 0, 50, 50), 5, 5);
SkRRect innerRRect;
innerRRect.setRectXY(SkRect::MakeXYWH(5, 8, 35, 30), 8, 3);
canvas->drawDRRect(outerRRect, innerRRect, paint);
return outerRRect.getBounds();
}
示例7: draw_rrect
static void draw_rrect(SkCanvas* canvas, const SkRect& r, const SkPaint& p) {
SkScalar xRad = r.width() / 4.0f;
SkScalar yRad = r.height() / 4.0f;
SkRRect rr;
rr.setRectXY(r, xRad, yRad);
canvas->drawRRect(rr, p);
}
示例8: initialize
void initialize(const SkRRect& rrect, const SkPoint& p, const SkVector& s) {
objectNode = sksg::RRect::Make(rrect);
shadowNode = sksg::RRect::Make(rrect);
pos = p;
spd = s;
size = SkSize::Make(rrect.width(), rrect.height());
}
示例9: test_mix
static void test_mix(skiatest::Reporter* reporter) {
// Test out mixed degenerate and non-degenerate geometry with Conics
const SkVector radii[4] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 100, 100 } };
SkRect r = SkRect::MakeWH(100, 100);
SkRRect rr;
rr.setRectRadii(r, radii);
path_contains_rrect_check(reporter, rr);
}
示例10: draw
void draw(SkCanvas* canvas) {
SkRRect rrect;
SkPaint p;
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(10);
canvas->drawRRect(rrect, p);
rrect.setRect({10, 10, 100, 50});
canvas->drawRRect(rrect, p);
}
示例11: result
Json::Value SkJSONCanvas::makeRRect(const SkRRect& rrect) {
Json::Value result(Json::arrayValue);
result.append(this->makeRect(rrect.rect()));
result.append(this->makePoint(rrect.radii(SkRRect::kUpperLeft_Corner)));
result.append(this->makePoint(rrect.radii(SkRRect::kUpperRight_Corner)));
result.append(this->makePoint(rrect.radii(SkRRect::kLowerRight_Corner)));
result.append(this->makePoint(rrect.radii(SkRRect::kLowerLeft_Corner)));
return result;
}
示例12: 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);
}
示例13: draw
void draw(SkCanvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
SkRRect rrect = SkRRect::MakeRectXY({100, 20, 140, 220}, 50, 100);
for (int index = 0; index < 25; ++index) {
canvas->drawRRect(rrect, paint);
rrect.outset(3, 3);
}
}
示例14: draw
void draw(SkCanvas* canvas) {
canvas->clear(SK_ColorWHITE);
SkPaint paint;
paint.setAntiAlias(true);
paint.setColor(0x8055aaff);
SkRRect oval;
oval.setOval({10, 20, 90, 100});
canvas->clipRRect(oval, SkClipOp::kIntersect, true);
canvas->drawCircle(70, 100, 60, paint);
}
示例15: test_crbug_472147_simple
// http://crbug.com/472147
// This is a simplified version from the bug. RRect radii not properly scaled.
static void test_crbug_472147_simple(skiatest::Reporter* reporter) {
auto surface(SkSurface::MakeRasterN32Premul(1000, 1000));
SkCanvas* canvas = surface->getCanvas();
SkPaint p;
SkRect r = SkRect::MakeLTRB(-246.0f, 33.0f, 848.0f, 33554464.0f);
SkVector radii[4] = {
{ 13.0f, 8.0f }, { 170.0f, 2.0 }, { 256.0f, 33554430.0f }, { 120.0f, 5.0f }
};
SkRRect rr;
rr.setRectRadii(r, radii);
canvas->drawRRect(rr, p);
}