本文整理汇总了C++中SkPath::rLineTo方法的典型用法代码示例。如果您正苦于以下问题:C++ SkPath::rLineTo方法的具体用法?C++ SkPath::rLineTo怎么用?C++ SkPath::rLineTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkPath
的用法示例。
在下文中一共展示了SkPath::rLineTo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: make_tri_path
// Make an equilateral triangle path with its top corner at (originX, originY)
static SkPath make_tri_path(SkScalar originX, SkScalar originY) {
SkPath tri;
tri.moveTo(originX, originY);
tri.rLineTo(SkScalarHalf(kTriSide), 1.5f * kTriSide / kRoot3);
tri.rLineTo(-kTriSide, 0);
tri.close();
return tri;
}
示例2: make_hex_path
// Create a hexagon centered at (originX, originY)
static SkPath make_hex_path(SkScalar originX, SkScalar originY) {
SkPath hex;
hex.moveTo(originX-kHexSide, originY);
hex.rLineTo(SkScalarHalf(kHexSide), kRoot3Over2 * kHexSide);
hex.rLineTo(SkIntToScalar(kHexSide), 0);
hex.rLineTo(SkScalarHalf(kHexSide), -kHexSide * kRoot3Over2);
hex.rLineTo(-SkScalarHalf(kHexSide), -kHexSide * kRoot3Over2);
hex.rLineTo(-SkIntToScalar(kHexSide), 0);
hex.close();
return hex;
}
示例3:
void
skiaDrawTriangle(caskbench_context_t *ctx, shapes_t *args)
{
// Temporarily disable anti-aliasing to work around crash in GlShader
ctx->skia_paint->setAntiAlias(false);
path.reset();
path.moveTo(args->x, args->y + 2*args->radius);
path.rLineTo(2*args->radius, 0);
path.rLineTo(-args->radius, -2*args->radius);
path.close();
ctx->skia_canvas->drawPath(path, *(ctx->skia_paint));
ctx->skia_paint->setAntiAlias(true);
}
示例4: paintMenuList
bool RenderThemeChromiumSkia::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect)
{
SkCanvas* const canvas = i.context->platformContext()->canvas();
const int right = rect.x() + rect.width();
const int middle = rect.y() + rect.height() / 2;
paintButtonLike(this, o, i, rect);
SkPaint paint;
paint.setARGB(0xff, 0, 0, 0);
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kFill_Style);
SkPath path;
path.moveTo(right - 13, middle - 3);
path.rLineTo(6, 0);
path.rLineTo(-3, 6);
path.close();
canvas->drawPath(path, paint);
return false;
}
示例5: paintMenuList
bool RenderThemeChromiumSkia::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect)
{
SkCanvas* const canvas = i.context->platformContext()->canvas();
const int right = rect.x() + rect.width();
const int middle = rect.y() + rect.height() / 2;
paintButtonLike(this, o, i, rect);
SkPaint paint;
paint.setColor(SK_ColorBLACK);
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kFill_Style);
int arrowXPosition = (o->style()->direction() == RTL) ? rect.x() + 7 : right - 13;
SkPath path;
path.moveTo(arrowXPosition, middle - 3);
path.rLineTo(6, 0);
path.rLineTo(-3, 6);
path.close();
canvas->drawPath(path, paint);
return false;
}
示例6: draw_vector_logo
static void draw_vector_logo(SkCanvas* canvas, const SkRect& viewBox) {
constexpr char kSkiaStr[] = "SKIA";
constexpr SkScalar kGradientPad = .1f;
constexpr SkScalar kVerticalSpacing = 0.25f;
constexpr SkScalar kAccentScale = 1.20f;
SkPaint paint;
paint.setAntiAlias(true);
paint.setSubpixelText(true);
paint.setFakeBoldText(true);
sk_tool_utils::set_portable_typeface(&paint);
SkPath path;
SkRect iBox, skiBox, skiaBox;
paint.getTextPath("SKI", 3, 0, 0, &path);
TightBounds(path, &skiBox);
paint.getTextPath("I", 1, 0, 0, &path);
TightBounds(path, &iBox);
iBox.offsetTo(skiBox.fRight - iBox.width(), iBox.fTop);
const size_t textLen = strlen(kSkiaStr);
paint.getTextPath(kSkiaStr, textLen, 0, 0, &path);
TightBounds(path, &skiaBox);
skiaBox.outset(0, 2 * iBox.width() * (kVerticalSpacing + 1));
const SkScalar accentSize = iBox.width() * kAccentScale;
const SkScalar underlineY = iBox.bottom() +
(kVerticalSpacing + SkScalarSqrt(3) / 2) * accentSize;
SkMatrix m;
m.setRectToRect(skiaBox, viewBox, SkMatrix::kFill_ScaleToFit);
SkAutoCanvasRestore acr(canvas, true);
canvas->concat(m);
canvas->drawCircle(iBox.centerX(),
iBox.y() - (0.5f + kVerticalSpacing) * accentSize,
accentSize / 2,
paint);
path.reset();
path.moveTo(iBox.centerX() - accentSize / 2, iBox.bottom() + kVerticalSpacing * accentSize);
path.rLineTo(accentSize, 0);
path.lineTo(iBox.centerX(), underlineY);
canvas->drawPath(path, paint);
SkRect underlineRect = SkRect::MakeLTRB(iBox.centerX() - iBox.width() * accentSize * 3,
underlineY,
iBox.centerX(),
underlineY + accentSize / 10);
const SkPoint pts1[] = { SkPoint::Make(underlineRect.x(), 0),
SkPoint::Make(iBox.centerX(), 0) };
const SkScalar pos1[] = { 0, 0.75f };
const SkColor colors1[] = { SK_ColorTRANSPARENT, SK_ColorBLACK };
SkASSERT(SK_ARRAY_COUNT(pos1) == SK_ARRAY_COUNT(colors1));
paint.setShader(SkGradientShader::MakeLinear(pts1, colors1, pos1, SK_ARRAY_COUNT(pos1),
SkShader::kClamp_TileMode));
canvas->drawRect(underlineRect, paint);
const SkPoint pts2[] = { SkPoint::Make(iBox.x() - iBox.width() * kGradientPad, 0),
SkPoint::Make(iBox.right() + iBox.width() * kGradientPad, 0) };
const SkScalar pos2[] = { 0, .01f, 1.0f/3, 1.0f/3, 2.0f/3, 2.0f/3, .99f, 1 };
const SkColor colors2[] = {
SK_ColorBLACK,
0xffca5139,
0xffca5139,
0xff8dbd53,
0xff8dbd53,
0xff5460a5,
0xff5460a5,
SK_ColorBLACK
};
SkASSERT(SK_ARRAY_COUNT(pos2) == SK_ARRAY_COUNT(colors2));
paint.setShader(SkGradientShader::MakeLinear(pts2, colors2, pos2, SK_ARRAY_COUNT(pos2),
SkShader::kClamp_TileMode));
canvas->drawText(kSkiaStr, textLen, 0, 0, paint);
}
示例7: makePath
//.........这里部分代码省略.........
--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: {
SkScalar x = makeScalar();
SkScalar y = makeScalar();
path.rMoveTo(x, y);
validate(path);
} break;
case kLineToPath: {
SkScalar x = makeScalar();
SkScalar y = makeScalar();
path.lineTo(x, y);
validate(path);
} break;
case kRLineToPath: {
SkScalar x = makeScalar();
SkScalar y = makeScalar();
path.rLineTo(x, y);
validate(path);
} break;
case kQuadToPath: {
SkPoint pt[2];
makePointArray(SK_ARRAY_COUNT(pt), pt);
path.quadTo(pt[0], pt[1]);
validate(path);
} break;
case kRQuadToPath: {
SkPoint pt[2];
makePointArray(SK_ARRAY_COUNT(pt), pt);
path.rQuadTo(pt[0].fX, pt[0].fY, pt[1].fX, pt[1].fY);
validate(path);
} break;
case kConicToPath: {
SkPoint pt[2];
makePointArray(SK_ARRAY_COUNT(pt), pt);
SkScalar weight = makeScalar();
path.conicTo(pt[0], pt[1], weight);
validate(path);
} break;
case kRConicToPath: {
SkPoint pt[2];
makePointArray(SK_ARRAY_COUNT(pt), pt);
SkScalar weight = makeScalar();
path.rConicTo(pt[0].fX, pt[0].fY, pt[1].fX, pt[1].fY, weight);
validate(path);
} break;
case kCubicToPath: {
SkPoint pt[3];
makePointArray(SK_ARRAY_COUNT(pt), pt);
path.cubicTo(pt[0], pt[1], pt[2]);
validate(path);
} break;
case kRCubicToPath: {
SkPoint pt[3];
makePointArray(SK_ARRAY_COUNT(pt), pt);
path.rCubicTo(pt[0].fX, pt[0].fY, pt[1].fX, pt[1].fY, pt[2].fX, pt[2].fY);
validate(path);
} break;
case kArcToPath: {
SkPoint pt[2];
makePointArray(SK_ARRAY_COUNT(pt), pt);
SkScalar radius = makeScalar();
path.arcTo(pt[0], pt[1], radius);
validate(path);
} break;
case kArcTo2Path: {
SkRect oval = makeRect();
SkScalar startAngle = makeAngle();
SkScalar sweepAngle = makeAngle();
bool forceMoveTo = makeBool();
path.arcTo(oval, startAngle, sweepAngle, forceMoveTo);
validate(path);
} break;
case kClosePath:
path.close();
validate(path);
break;
}
}
}
return path;
}
示例8: paintArrowButton
void PlatformThemeChromiumLinux::paintArrowButton(GraphicsContext* gc, const IntRect& rect, ArrowDirection direction, ControlStates states)
{
SkCanvas* const canvas = gc->platformContext()->canvas();
int widthMiddle, lengthMiddle;
SkPaint paint;
if (direction == North || direction == South) {
widthMiddle = rect.width() / 2 + 1;
lengthMiddle = rect.height() / 2 + 1;
} else {
lengthMiddle = rect.width() / 2 + 1;
widthMiddle = rect.height() / 2 + 1;
}
// Calculate button color.
SkScalar trackHSV[3];
SkColorToHSV(trackColor(), trackHSV);
SkColor buttonColor = saturateAndBrighten(trackHSV, 0, 0.2);
SkColor backgroundColor = buttonColor;
if (states & PressedState) {
SkScalar buttonHSV[3];
SkColorToHSV(buttonColor, buttonHSV);
buttonColor = saturateAndBrighten(buttonHSV, 0, -0.1);
} else if (states & HoverState) {
SkScalar buttonHSV[3];
SkColorToHSV(buttonColor, buttonHSV);
buttonColor = saturateAndBrighten(buttonHSV, 0, 0.05);
}
SkIRect skrect;
skrect.set(rect.x(), rect.y(), rect.x() + rect.width(), rect.y() + rect.height());
// Paint the background (the area visible behind the rounded corners).
paint.setColor(backgroundColor);
canvas->drawIRect(skrect, paint);
// Paint the button's outline and fill the middle
SkPath outline;
switch (direction) {
case North:
outline.moveTo(rect.x() + 0.5, rect.y() + rect.height() + 0.5);
outline.rLineTo(0, -(rect.height() - 2));
outline.rLineTo(2, -2);
outline.rLineTo(rect.width() - 5, 0);
outline.rLineTo(2, 2);
outline.rLineTo(0, rect.height() - 2);
break;
case South:
outline.moveTo(rect.x() + 0.5, rect.y() - 0.5);
outline.rLineTo(0, rect.height() - 2);
outline.rLineTo(2, 2);
outline.rLineTo(rect.width() - 5, 0);
outline.rLineTo(2, -2);
outline.rLineTo(0, -(rect.height() - 2));
break;
case East:
outline.moveTo(rect.x() - 0.5, rect.y() + 0.5);
outline.rLineTo(rect.width() - 2, 0);
outline.rLineTo(2, 2);
outline.rLineTo(0, rect.height() - 5);
outline.rLineTo(-2, 2);
outline.rLineTo(-(rect.width() - 2), 0);
break;
case West:
outline.moveTo(rect.x() + rect.width() + 0.5, rect.y() + 0.5);
outline.rLineTo(-(rect.width() - 2), 0);
outline.rLineTo(-2, 2);
outline.rLineTo(0, rect.height() - 5);
outline.rLineTo(2, 2);
outline.rLineTo(rect.width() - 2, 0);
break;
}
outline.close();
paint.setStyle(SkPaint::kFill_Style);
paint.setColor(buttonColor);
canvas->drawPath(outline, paint);
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
SkScalar thumbHSV[3];
SkColorToHSV(thumbInactiveColor(), thumbHSV);
paint.setColor(outlineColor(trackHSV, thumbHSV));
canvas->drawPath(outline, paint);
// If the button is disabled or read-only, the arrow is drawn with the outline color.
if (states & EnabledState && !(states & ReadOnlyState))
paint.setColor(SK_ColorBLACK);
paint.setAntiAlias(false);
paint.setStyle(SkPaint::kFill_Style);
SkPath path;
// The constants in this block of code are hand-tailored to produce good
// looking arrows without anti-aliasing.
switch (direction) {
case North:
path.moveTo(rect.x() + widthMiddle - 4, rect.y() + lengthMiddle + 2);
path.rLineTo(7, 0);
path.rLineTo(-4, -4);
break;
case South:
//.........这里部分代码省略.........