Flutter Engine
The Flutter Engine
Functions
Path_addRRect_2.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (Path_addRRect_2, 256, 256, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Path_addRRect_2  ,
256  ,
256  ,
false  ,
 
)

Definition at line 4 of file Path_addRRect_2.cpp.

4 {
5void draw(SkCanvas* canvas) {
7 paint.setAntiAlias(true);
9 rrect.setRectXY({40, 40, 215, 215}, 50, 50);
11 path.addRRect(rrect);
12 canvas->drawPath(path, paint);
13 for (int start = 0; start < 8; ++start) {
14 SkPath textPath;
16 SkPathMeasure pathMeasure(textPath, false);
17 SkPoint position;
18 SkVector tangent;
19 if (!pathMeasure.getPosTan(0, &position, &tangent)) {
20 continue;
21 }
22 SkRSXform rsxForm = SkRSXform::Make(tangent.fX, tangent.fY,
23 position.fX + tangent.fY * 5, position.fY - tangent.fX * 5);
24 SkFont font(fontMgr->matchFamilyStyle(nullptr, {}), 12);
25 auto labels = SkTextBlob::MakeFromRSXform(&"01234567"[start], 1, &rsxForm, font);
26 canvas->drawTextBlob(labels, 0, 0, paint);
27 }
28}
29} // END FIDDLE
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
void drawTextBlob(const SkTextBlob *blob, SkScalar x, SkScalar y, const SkPaint &paint)
Definition: SkCanvas.cpp:2484
sk_sp< SkTypeface > matchFamilyStyle(const char familyName[], const SkFontStyle &) const
Definition: SkFontMgr.cpp:109
Definition: SkFont.h:35
Definition: SkPath.h:59
SkPath & addRRect(const SkRRect &rrect, SkPathDirection dir=SkPathDirection::kCW)
Definition: SkPath.cpp:1000
void setRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
Definition: SkRRect.cpp:52
static sk_sp< SkTextBlob > MakeFromRSXform(const void *text, size_t byteLength, const SkRSXform xform[], const SkFont &font, SkTextEncoding encoding=SkTextEncoding::kUTF8)
Definition: SkTextBlob.cpp:831
const Paint & paint
Definition: color_source.cc:38
sk_sp< SkFontMgr > fontMgr
Definition: examples.cpp:32
SkRRect rrect
Definition: SkRecords.h:232
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
font
Font Metadata and Metrics.
float fX
x-axis value
Definition: SkPoint_impl.h:164
float fY
y-axis value
Definition: SkPoint_impl.h:165
static SkRSXform Make(SkScalar scos, SkScalar ssin, SkScalar tx, SkScalar ty)
Definition: SkRSXform.h:24