本文整理汇总了C++中SkPath::rewind方法的典型用法代码示例。如果您正苦于以下问题:C++ SkPath::rewind方法的具体用法?C++ SkPath::rewind怎么用?C++ SkPath::rewind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkPath
的用法示例。
在下文中一共展示了SkPath::rewind方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void draw(SkCanvas* canvas) {
SkPaint paint;
SkPath path;
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(4);
path.moveTo(0, 0);
path.arcTo({20, 20, 120, 120}, -90, 90, false);
canvas->drawPath(path, paint);
path.rewind();
path.arcTo({120, 20, 220, 120}, -90, 90, false);
canvas->drawPath(path, paint);
path.rewind();
path.moveTo(0, 0);
path.arcTo({20, 120, 120, 220}, -90, 90, true);
canvas->drawPath(path, paint);
}
示例2: finishContour
void SkPathStroker::finishContour(bool close, bool currIsLine) {
if (fSegmentCount > 0) {
SkPoint pt;
if (close) {
fJoiner(&fOuter, &fInner, fPrevUnitNormal, fPrevPt,
fFirstUnitNormal, fRadius, fInvMiterLimit,
fPrevIsLine, currIsLine);
fOuter.close();
// now add fInner as its own contour
fInner.getLastPt(&pt);
fOuter.moveTo(pt.fX, pt.fY);
fOuter.reversePathTo(fInner);
fOuter.close();
} else { // add caps to start and end
// cap the end
fInner.getLastPt(&pt);
fCapper(&fOuter, fPrevPt, fPrevNormal, pt,
currIsLine ? &fInner : NULL);
fOuter.reversePathTo(fInner);
// cap the start
fCapper(&fOuter, fFirstPt, -fFirstNormal, fFirstOuterPt,
fPrevIsLine ? &fInner : NULL);
fOuter.close();
}
}
// since we may re-use fInner, we rewind instead of reset, to save on
// reallocating its internal storage.
fInner.rewind();
fSegmentCount = -1;
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_skia_src,代码行数:31,代码来源:SkStroke.cpp
示例3: drawAtlas
void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkRSXform xform[],
const SkRect tex[], const SkColor colors[], int count,
SkXfermode::Mode mode, const SkPaint& paint) {
SkPath path;
path.setIsVolatile(true);
for (int i = 0; i < count; ++i) {
SkPoint quad[4];
xform[i].toQuad(tex[i].width(), tex[i].height(), quad);
SkMatrix localM;
localM.setRSXform(xform[i]);
localM.preTranslate(-tex[i].left(), -tex[i].top());
SkPaint pnt(paint);
sk_sp<SkShader> shader = atlas->makeShader(SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode,
&localM);
if (!shader) {
break;
}
pnt.setShader(std::move(shader));
if (colors) {
pnt.setColorFilter(SkColorFilter::MakeModeFilter(colors[i], mode));
}
path.rewind();
path.addPoly(quad, 4, true);
path.setConvexity(SkPath::kConvex_Convexity);
this->drawPath(draw, path, pnt, nullptr, true);
}
}
示例4: drawPoints
void SkSVGDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_t count,
const SkPoint pts[], const SkPaint& paint) {
SkPath path;
switch (mode) {
// todo
case SkCanvas::kPoints_PointMode:
SkDebugf("unsupported operation: drawPoints(kPoints_PointMode)\n");
break;
case SkCanvas::kLines_PointMode:
count -= 1;
for (size_t i = 0; i < count; i += 2) {
path.rewind();
path.moveTo(pts[i]);
path.lineTo(pts[i+1]);
AutoElement elem("path", fWriter, fResourceBucket, draw, paint);
elem.addPathAttributes(path);
}
break;
case SkCanvas::kPolygon_PointMode:
if (count > 1) {
path.addPoly(pts, SkToInt(count), false);
path.moveTo(pts[0]);
AutoElement elem("path", fWriter, fResourceBucket, draw, paint);
elem.addPathAttributes(path);
}
break;
}
}
示例5: drawAtlas
void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkRSXform xform[],
const SkRect tex[], const SkColor colors[], int count,
SkXfermode::Mode mode, const SkPaint& paint) {
SkPath path;
path.setIsVolatile(true);
for (int i = 0; i < count; ++i) {
SkPoint quad[4];
xform[i].toQuad(tex[i].width(), tex[i].height(), quad);
SkMatrix localM;
localM.setRSXform(xform[i]);
localM.preTranslate(-tex[i].left(), -tex[i].top());
SkPaint pnt(paint);
pnt.setShader(atlas->newShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode,
&localM))->unref();
if (colors && colors[i] != SK_ColorWHITE) {
SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(colors[i], mode));
pnt.setColorFilter(cf);
}
path.rewind();
path.addPoly(quad, 4, true);
path.setConvexity(SkPath::kConvex_Convexity);
this->drawPath(draw, path, pnt, NULL, true);
}
}
示例6: onDraw
void onDraw(int loops, SkCanvas*) override {
SkPath dst;
for (int i = 0; i < loops; ++i) {
SkStrokeRec rec(SkStrokeRec::kHairline_InitStyle);
fPE->filterPath(&dst, fPath, &rec, nullptr);
dst.rewind();
}
}
示例7:
static void
_update_path(mbe_t *mbe) {
SkPath *path = mbe->path;
SkPath *subpath = mbe->subpath;
SkMatrix canvas_matrix;
SkPoint point;
MB_MATRIX_2_SKMATRIX(canvas_matrix, mbe->states->matrix);
path->addPath(*subpath, canvas_matrix);
subpath->getLastPt(&point);
subpath->rewind();
subpath->moveTo(point);
}
示例8: mbe_stroke
void mbe_stroke(mbe_t *canvas) {
SkPath *path = canvas->path;
SkPaint *paint = canvas->paint;
ASSERT(ptn);
ASSERT(path);
ASSERT(paint);
if(!canvas->subpath->isEmpty())
_update_path(canvas);
_prepare_paint(canvas, SkPaint::kStroke_Style);
canvas->canvas->drawPath(*path, *paint);
_finish_paint(canvas);
path->rewind();
canvas->subpath->rewind();
}