Flutter Engine
The Flutter Engine
Classes | Functions
dashcubics.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/SkPath.h"
#include "include/core/SkPathEffect.h"
#include "include/core/SkScalar.h"
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "include/effects/SkDashPathEffect.h"
#include "include/effects/SkTrimPathEffect.h"
#include "include/private/base/SkTArray.h"
#include "include/utils/SkParsePath.h"
#include "tools/timer/TimeUtils.h"
#include <math.h>
#include <utility>

Go to the source code of this file.

Classes

class  TrimGM
 

Functions

static void flower (SkCanvas *canvas, const SkPath &path, SkScalar intervals[2], SkPaint::Join join)
 
 DEF_SIMPLE_GM (dashcubics, canvas, 865, 750)
 

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( dashcubics  ,
canvas  ,
865  ,
750   
)

Definition at line 52 of file dashcubics.cpp.

52 {
54 const char* d = "M 337,98 C 250,141 250,212 250,212 C 250,212 250,212 250,212"
55 "C 250,212 250,212 250,212 C 250,212 250,141 163,98 C 156,195 217,231 217,231"
56 "C 217,231 217,231 217,231 C 217,231 217,231 217,231 C 217,231 156,195 75,250"
57 "C 156,305 217,269 217,269 C 217,269 217,269 217,269 C 217,269 217,269 217,269"
58 "C 217,269 156,305 163,402 C 250,359 250,288 250,288 C 250,288 250,288 250,288"
59 "C 250,288 250,288 250,288 C 250,288 250,359 338,402 C 345,305 283,269 283,269"
60 "C 283,269 283,269 283,269 C 283,269 283,269 283,269 C 283,269 345,305 425,250"
61 "C 344,195 283,231 283,231 C 283,231 283,231 283,231 C 283,231 283,231 283,231"
62 "C 283,231 344,195 338,98";
63
65 canvas->translate(-35.f, -55.f);
66 for (int x = 0; x < 2; ++x) {
67 for (int y = 0; y < 2; ++y) {
68 canvas->save();
69 canvas->translate(x * 430.f, y * 355.f);
70 SkScalar intervals[] = { 5 + (x ? 0 : 0.0001f + 0.0001f), 10 };
72 canvas->restore();
73 }
74 }
75}
@ kDefault_Join
equivalent to kMiter_Join
Definition: SkPaint.h:363
@ kRound_Join
adds circle
Definition: SkPaint.h:360
static bool FromSVGString(const char str[], SkPath *)
Definition: SkPath.h:59
static void flower(SkCanvas *canvas, const SkPath &path, SkScalar intervals[2], SkPaint::Join join)
Definition: dashcubics.cpp:32
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition: main.cc:19
float SkScalar
Definition: extension.cpp:12
double y
double x
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

◆ flower()

static void flower ( SkCanvas canvas,
const SkPath path,
SkScalar  intervals[2],
SkPaint::Join  join 
)
static

Definition at line 32 of file dashcubics.cpp.

33 {
35 paint.setAntiAlias(true);
36 paint.setStroke(true);
37 paint.setStrokeJoin(join);
38 paint.setStrokeWidth(42);
39 canvas->drawPath(path, paint);
40
41 paint.setColor(SK_ColorRED);
42 paint.setStrokeWidth(21);
43 paint.setPathEffect(SkDashPathEffect::Make(intervals, 2, 0));
44 canvas->drawPath(path, paint);
45
46 paint.setColor(SK_ColorGREEN);
47 paint.setPathEffect(nullptr);
48 paint.setStrokeWidth(0);
49 canvas->drawPath(path, paint);
50}
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
static sk_sp< SkPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)
const Paint & paint
Definition: color_source.cc:38
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741