Flutter Engine
The Flutter Engine
cubics_are_horrible.cpp
Go to the documentation of this file.
1// Copyright 2020 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4REG_FIDDLE(cubics_are_horrible, 256, 256, false, 0) {
5void draw(SkCanvas* canvas) {
6 canvas->scale(0.4, 0.4);
7 canvas->translate(175, 175);
8
10 p.setColor(SK_ColorBLACK);
11 p.setAntiAlias(true);
12 p.setStyle(SkPaint::kStroke_Style);
13 p.setStrokeWidth(400);
14
15 SkPoint p1 = SkPoint::Make(60, -40);
16 SkPoint p2 = SkPoint::Make(120, 150);
17 SkPoint p3 = SkPoint::Make(180, 60);
18
20 path.moveTo(20, 60);
21 path.cubicTo(p1, p2, p3);
22 // path.close();
23
24 SkPath fillpath;
26 SkPaint fillp;
28 fillp.setAntiAlias(true);
30 fillp.setStrokeWidth(0);
31
32 canvas->drawPath(path, p);
33 canvas->drawPath(fillpath, fillp);
34}
35} // END FIDDLE
constexpr SkColor SK_ColorMAGENTA
Definition: SkColor.h:147
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
void setStyle(Style style)
Definition: SkPaint.cpp:105
void setColor(SkColor color)
Definition: SkPaint.cpp:119
void setAntiAlias(bool aa)
Definition: SkPaint.h:170
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
void setStrokeWidth(SkScalar width)
Definition: SkPaint.cpp:159
Definition: SkPath.h:59
REG_FIDDLE(cubics_are_horrible, 256, 256, false, 0)
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
SK_API bool FillPathWithPaint(const SkPath &src, const SkPaint &paint, SkPath *dst, const SkRect *cullRect, SkScalar resScale=1)
Definition: SkPathUtils.cpp:23
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173