本文整理汇总了C++中SkRRect::height方法的典型用法代码示例。如果您正苦于以下问题:C++ SkRRect::height方法的具体用法?C++ SkRRect::height怎么用?C++ SkRRect::height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkRRect
的用法示例。
在下文中一共展示了SkRRect::height方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SkASSERT
void InstancedRendering::Batch::appendRRectParams(const SkRRect& rrect) {
SkASSERT(!fIsTracked);
switch (rrect.getType()) {
case SkRRect::kSimple_Type: {
const SkVector& radii = rrect.getSimpleRadii();
this->appendParamsTexel(radii.x(), radii.y(), rrect.width(), rrect.height());
return;
}
case SkRRect::kNinePatch_Type: {
float twoOverW = 2 / rrect.width();
float twoOverH = 2 / rrect.height();
const SkVector& radiiTL = rrect.radii(SkRRect::kUpperLeft_Corner);
const SkVector& radiiBR = rrect.radii(SkRRect::kLowerRight_Corner);
this->appendParamsTexel(radiiTL.x() * twoOverW, radiiBR.x() * twoOverW,
radiiTL.y() * twoOverH, radiiBR.y() * twoOverH);
return;
}
case SkRRect::kComplex_Type: {
/**
* The x and y radii of each arc are stored in separate vectors,
* in the following order:
*
* __x1 _ _ _ x3__
* y1 | | y2
*
* | |
*
* y3 |__ _ _ _ __| y4
* x2 x4
*
*/
float twoOverW = 2 / rrect.width();
float twoOverH = 2 / rrect.height();
const SkVector& radiiTL = rrect.radii(SkRRect::kUpperLeft_Corner);
const SkVector& radiiTR = rrect.radii(SkRRect::kUpperRight_Corner);
const SkVector& radiiBR = rrect.radii(SkRRect::kLowerRight_Corner);
const SkVector& radiiBL = rrect.radii(SkRRect::kLowerLeft_Corner);
this->appendParamsTexel(radiiTL.x() * twoOverW, radiiBL.x() * twoOverW,
radiiTR.x() * twoOverW, radiiBR.x() * twoOverW);
this->appendParamsTexel(radiiTL.y() * twoOverH, radiiTR.y() * twoOverH,
radiiBL.y() * twoOverH, radiiBR.y() * twoOverH);
return;
}
default: return;
}
}
示例2: 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());
}
示例3: initialize
void initialize(const SkRRect& rrect, SkColor color,
const SkPoint& p, const SkVector& s) {
objectNode = make_svg_rrect(rrect);
objectNode->setFill(SkSVGPaint(SkSVGColorType(color)));
shadowNode = make_svg_rrect(rrect);
shadowNode->setFillOpacity(SkSVGNumberType(kShadowOpacity));
pos = p;
spd = s;
size = SkSize::Make(rrect.width(), rrect.height());
}
示例4: SkScalarHalf
// Test out the case where an oval already off in space is translated/scaled
// further off into space - yielding numerical issues when the rect & radii
// are transformed separatly
// BUG=skia:2696
static void test_issue_2696(skiatest::Reporter* reporter) {
SkRRect rrect;
SkRect r = { 28443.8594f, 53.1428604f, 28446.7148f, 56.0000038f };
rrect.setOval(r);
SkMatrix xform;
xform.setAll(2.44f, 0.0f, 485411.7f,
0.0f, 2.44f, -438.7f,
0.0f, 0.0f, 1.0f);
SkRRect dst;
bool success = rrect.transform(xform, &dst);
REPORTER_ASSERT(reporter, success);
SkScalar halfWidth = SkScalarHalf(dst.width());
SkScalar halfHeight = SkScalarHalf(dst.height());
for (int i = 0; i < 4; ++i) {
REPORTER_ASSERT(reporter,
SkScalarNearlyEqual(dst.radii((SkRRect::Corner)i).fX, halfWidth));
REPORTER_ASSERT(reporter,
SkScalarNearlyEqual(dst.radii((SkRRect::Corner)i).fY, halfHeight));
}
}
示例5: test_tricky_radii
static void test_tricky_radii(skiatest::Reporter* reporter) {
{
// crbug.com/458522
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);
}
{
// crbug.com//463920
SkRect r = SkRect::MakeLTRB(0, 0, 1009, 33554432.0);
SkVector radii[4] = {
{ 13.0f, 8.0f }, { 170.0f, 2.0 }, { 256.0f, 33554432.0 }, { 110.0f, 5.0f }
};
SkRRect rr;
rr.setRectRadii(r, radii);
REPORTER_ASSERT(reporter, (double) rr.radii(SkRRect::kUpperRight_Corner).fY +
(double) rr.radii(SkRRect::kLowerRight_Corner).fY <=
rr.height());
}
}