Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
SKIA_LOGO.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (SKIA_LOGO, 816, 464, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( SKIA_LOGO  ,
816  ,
464  ,
false  ,
 
)

Definition at line 4 of file SKIA_LOGO.cpp.

4 {
5void draw(SkCanvas* canvas) {
6 canvas->scale(4.0f, 4.0f);
7 const SkColor background = SK_ColorWHITE; // SK_ColorTRANSPARENT;
8 const SkColor rgb[] = {0xFFE94037, 0xFF70BF4F, 0xFF465BA6};
9 const SkColor lettering = 0xFF292929;
10 const SkColor lineColors[2] = {0x30565656, 0xFF565656};
11 SkPath s, k, a, triangle;
12 SkPaint p;
13 p.setAntiAlias(true);
14
15 canvas->clear(background);
16 canvas->scale(0.363f, 0.363f);
17
18 p.setColor(rgb[1]);
19 canvas->drawRect({326.0, 82.25, 343.9, 249.2}, p);
20 p.setColor(rgb[0]);
21 canvas->drawRect({310.2, 82.25, 327.0, 249.2}, p);
22 p.setColor(rgb[2]);
23 canvas->drawRect({342.9, 82.25, 358.87, 249.2}, p);
24
25 p.setColor(lettering);
26 canvas->drawCircle(335.355, 45.965, 29.25, p);
27
28 s.moveTo(34.63, 100.63);
29 s.cubicTo(44.38, 88.57, 59.87, 82.86, 74.88, 81.2);
30 s.cubicTo(97.4, 78.5, 120.27, 83.25, 140.87, 92.37);
31 s.lineTo(127.12, 127.14);
32 s.cubicTo(113.55, 121.16, 99.04, 115.9, 83.98, 116.56);
33 s.cubicTo(78.86, 116.75, 72.88, 118.54, 70.71, 123.69);
34 s.cubicTo(68.62, 128.43, 71.52, 133.68, 75.58, 136.27);
35 s.cubicTo(91.49, 146.66, 110.67, 151.38, 125.46, 163.6);
36 s.cubicTo(132.35, 169.11, 137.33, 176.9, 139.36, 185.49);
37 s.cubicTo(142.55, 199.14, 140.94, 214.31, 133.13, 226.17);
38 s.cubicTo(126.23, 236.96, 114.82, 244.16, 102.75, 247.89);
39 s.cubicTo(87.95, 252.51, 72.16, 252.21, 56.88, 250.78);
40 s.cubicTo(45.54, 249.72, 34.64, 246.05, 24.32, 241.36);
41 s.lineTo(24.25, 201.1);
42 s.cubicTo(38.23, 208.15, 53.37, 213.15, 68.98, 214.75);
43 s.cubicTo(75.42, 215.25, 82.17, 215.63, 88.31, 213.27);
44 s.cubicTo(92.84, 211.53, 96.4, 206.93, 95.86, 201.93);
45 s.cubicTo(95.64, 196.77, 91.1, 193.38, 87.03, 190.99);
46 s.cubicTo(71.96, 182.67, 54.94, 177.66, 41.5, 166.57);
47 s.cubicTo(33.19, 159.73, 27.51, 149.8, 26.1, 139.11);
48 s.cubicTo(24.09, 125.88, 25.91, 111.25, 34.63, 100.63);
49 canvas->drawPath(s, p);
50
51 k.moveTo(160.82, 82.85);
52 k.lineTo(206.05, 82.85);
53 k.lineTo(206.05, 155.15);
54 k.lineTo(254.83, 82.84);
55 k.lineTo(304.01, 82.85);
56 k.lineTo(251.52, 157.27);
57 k.lineTo(303.09, 249.42);
58 k.lineTo(252.28, 249.4);
59 k.lineTo(219.18, 185.75);
60 k.lineTo(206.23, 193.45);
61 k.lineTo(206.05, 249.42);
62 k.lineTo(160.82, 249.42);
63 k.lineTo(160.82, 82.85);
64 canvas->drawPath(k, p);
65
66 a.moveTo(426.45, 218.16);
67 a.lineTo(480.705, 218.16);
68 a.lineTo(489.31, 249.4);
69 a.lineTo(538.54, 249.42);
70 a.lineTo(483.56, 82.18);
71 a.lineTo(423.43, 82.17);
72 a.lineTo(369.13, 249.42);
73 a.lineTo(418.5, 249.47);
74 a.lineTo(453.75, 109.83);
75 a.lineTo(471.77, 181.28);
76 a.lineTo(430.5, 181.28);
77 canvas->drawPath(a, p);
78
79 triangle.reset();
80 triangle.moveTo(362.64, 257.32);
81 triangle.lineTo(335.292, 293.392);
82 triangle.lineTo(307.8, 257.48);
83 triangle.lineTo(362.64, 257.32);
84 p.setColor(lettering);
85 canvas->drawPath(triangle, p);
86
87 // line
88 const SkPoint pts[2] = {{160, 290}, {341, 290}};
89 p.setShader(SkGradientShader::MakeLinear(pts, lineColors, nullptr, 2, SkTileMode::kClamp));
90 if (true) {
92 rrect.setRectXY({138, 291, 341, 300}, 25.0, 5.0);
93 canvas->drawRRect(rrect, p);
94 } else {
96 path.addRoundRect({138, 291, 341, 299.95}, 25.0, 5.0);
97 canvas->drawPath(path, p);
98 }
99}
100} // END FIDDLE
uint32_t SkColor
Definition SkColor.h:37
constexpr SkColor SK_ColorWHITE
Definition SkColor.h:122
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void drawRect(const SkRect &rect, const SkPaint &paint)
void clear(SkColor color)
Definition SkCanvas.h:1199
void drawRRect(const SkRRect &rrect, const SkPaint &paint)
void drawPath(const SkPath &path, const SkPaint &paint)
void scale(SkScalar sx, SkScalar sy)
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
SkPath & moveTo(SkScalar x, SkScalar y)
Definition SkPath.cpp:678
SkPath & lineTo(SkScalar x, SkScalar y)
Definition SkPath.cpp:718
SkPath & reset()
Definition SkPath.cpp:360
void setRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
Definition SkRRect.cpp:52
struct MyStruct s
struct MyStruct a[10]
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