Flutter Engine
The Flutter Engine
Functions
pathreverse.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPathBuilder.h"
#include "include/core/SkRect.h"
#include "include/core/SkString.h"

Go to the source code of this file.

Functions

static SkPath hiragino_maru_goth_pro_e ()
 
static void test_path (SkCanvas *canvas, const SkPath &path)
 
static void test_rev (SkCanvas *canvas, const SkPath &path)
 
 DEF_SIMPLE_GM_BG_NAME (pathreverse, canvas, 640, 480, SK_ColorWHITE, SkString("path-reverse"))
 

Function Documentation

◆ DEF_SIMPLE_GM_BG_NAME()

DEF_SIMPLE_GM_BG_NAME ( pathreverse  ,
canvas  ,
640  ,
480  ,
SK_ColorWHITE  ,
SkString("path-reverse")   
)

Definition at line 74 of file pathreverse.cpp.

75 {
76 SkRect r = { 10, 10, 100, 60 };
77
79
80 path.addRect(r); test_rev(canvas, path);
81
82 canvas->translate(0, 100);
83 path.offset(20, 20);
84 path.addRect(r); test_rev(canvas, path);
85
86 canvas->translate(0, 100);
87 path.reset();
88 path.moveTo(10, 10); path.lineTo(30, 30);
89 path.addOval(r);
90 r.offset(50, 20);
91 path.addOval(r);
92 test_rev(canvas, path);
93
95 canvas->translate(0, 100);
96 test_rev(canvas, path);
97}
Definition: SkPath.h:59
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
static SkPath hiragino_maru_goth_pro_e()
Definition: pathreverse.cpp:26
static void test_rev(SkCanvas *canvas, const SkPath &path)
Definition: pathreverse.cpp:63
void offset(float dx, float dy)
Definition: SkRect.h:1016

◆ hiragino_maru_goth_pro_e()

static SkPath hiragino_maru_goth_pro_e ( )
static

Definition at line 26 of file pathreverse.cpp.

26 {
28 path.moveTo(98.6f, 24.7f);
29 path.cubicTo(101.7f, 24.7f, 103.6f, 22.8f, 103.6f, 19.2f);
30 path.cubicTo(103.6f, 18.9f, 103.6f, 18.7f, 103.6f, 18.4f);
31 path.cubicTo(102.6f, 5.3f, 94.4f, -6.1f, 79.8f, -6.1f);
32 path.cubicTo(63.5f, -6.1f, 54.5f, 6, 54.5f, 23.3f);
33 path.cubicTo(54.5f, 40.6f, 64, 52.2f, 80.4f, 52.2f);
34 path.cubicTo(93.4f, 52.2f, 99.2f, 45.6f, 102.4f, 39);
35 path.cubicTo(102.8f, 38.4f, 102.9f, 37.8f, 102.9f, 37.2f);
36 path.cubicTo(102.9f, 35.4f, 101.5f, 34.2f, 99.8f, 33.7f);
37 path.cubicTo(99.1f, 33.5f, 98.4f, 33.3f, 97.7f, 33.3f);
38 path.cubicTo(96.3f, 33.3f, 95, 34, 94.1f, 35.8f);
39 path.cubicTo(91.7f, 41.1f, 87.7f, 44.7f, 80.5f, 44.7f);
40 path.cubicTo(69.7f, 44.7f, 63.6f, 37, 63.4f, 24.7f);
41 path.lineTo(98.6f, 24.7f);
42 path.close();
43 path.moveTo(63.7f, 17.4f);
44 path.cubicTo(65, 7.6f, 70.2f, 1.2f, 79.8f, 1.2f);
45 path.cubicTo(89, 1.2f, 93.3f, 8.5f, 94.5f, 15.6f);
46 path.cubicTo(94.5f, 15.8f, 94.5f, 16, 94.5f, 16.1f);
47 path.cubicTo(94.5f, 17, 94.1f, 17.4f, 93, 17.4f);
48 path.lineTo(63.7f, 17.4f);
49 path.close();
50 return path.detach();
51}

◆ test_path()

static void test_path ( SkCanvas canvas,
const SkPath path 
)
static

Definition at line 53 of file pathreverse.cpp.

53 {
55 paint.setAntiAlias(true);
56 canvas->drawPath(path, paint);
57
59 paint.setColor(SK_ColorRED);
60 canvas->drawPath(path, paint);
61}
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
const Paint & paint
Definition: color_source.cc:38

◆ test_rev()

static void test_rev ( SkCanvas canvas,
const SkPath path 
)
static

Definition at line 63 of file pathreverse.cpp.

63 {
64 test_path(canvas, path);
65
66 SkPath rev;
68 canvas->save();
69 canvas->translate(150, 0);
70 test_path(canvas, rev);
71 canvas->restore();
72}
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
int save()
Definition: SkCanvas.cpp:447
SkPath & reverseAddPath(const SkPath &src)
Definition: SkPath.cpp:1633
static void test_path(SkCanvas *canvas, const SkPath &path)
Definition: pathreverse.cpp:53