| Flutter Impeller |

aiks_path_unittests.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "flutter/impeller/aiks/aiks_unittests.h"
6
7 #include "impeller/aiks/canvas.h"
8 #include "impeller/geometry/path_builder.h"
9 #include "impeller/playground/widgets.h"
10 #include "third_party/imgui/imgui.h"
11
12 ////////////////////////////////////////////////////////////////////////////////
13 // This is for tests of Canvas that are interested the results of rendering
14 // paths.
15 ////////////////////////////////////////////////////////////////////////////////
16
17 namespace impeller {
18 namespace testing {
19
20 TEST_P(AiksTest, RotateColorFilteredPath) {
21 Canvas canvas;
22 canvas.Concat(Matrix::MakeTranslation({300, 300}));
23 canvas.Concat(Matrix::MakeRotationZ(Radians(kPiOver2)));
24 auto arrow_stem =
25 PathBuilder{}.MoveTo({120, 190}).LineTo({120, 50}).TakePath();
26 auto arrow_head = PathBuilder{}
27 .MoveTo({50, 120})
28 .LineTo({120, 190})
29 .LineTo({190, 120})
30 .TakePath();
31 auto paint = Paint{
32 .stroke_width = 15.0,
33 .stroke_cap = Cap::kRound,
34 .stroke_join = Join::kRound,
35 .style = Paint::Style::kStroke,
36 .color_filter =
37 ColorFilter::MakeBlend(BlendMode::kSourceIn, Color::AliceBlue()),
38 };
39
40 canvas.DrawPath(arrow_stem, paint);
41 canvas.DrawPath(arrow_head, paint);
42 ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
43 }
44
45 TEST_P(AiksTest, CanRenderStrokes) {
46 Canvas canvas;
47 Paint paint;
48 paint.color = Color::Red();
49 paint.stroke_width = 20.0;
50 paint.style = Paint::Style::kStroke;
51 canvas.DrawPath(PathBuilder{}.AddLine({200, 100}, {800, 100}).TakePath(),
52 paint);
53 ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
54 }
55
56 TEST_P(AiksTest, CanRenderCurvedStrokes) {
57 Canvas canvas;
58 Paint paint;
59 paint.color = Color::Red();
60 paint.stroke_width = 25.0;
61 paint.style = Paint::Style::kStroke;
62 canvas.DrawPath(PathBuilder{}.AddCircle({500, 500}, 250).TakePath(), paint);
63 ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
64 }
65
66 TEST_P(AiksTest, CanRenderThickCurvedStrokes) {
67 Canvas canvas;
68 Paint paint;
69 paint.color = Color::Red();
70 paint.stroke_width = 100.0;
71 paint.style = Paint::Style::kStroke;
72 canvas.DrawPath(PathBuilder{}.AddCircle({100, 100}, 50).TakePath(), paint);
73 ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
74 }
75
76 TEST_P(AiksTest, CanRenderStrokePathThatEndsAtSharpTurn) {
77 Canvas canvas;
78
79 Paint paint;
80 paint.color = Color::Red();
81 paint.style = Paint::Style::kStroke;
82 paint.stroke_width = 200;
83
84 Rect rect = Rect::MakeXYWH(100, 100, 200, 200);
85 PathBuilder builder;
86 builder.AddArc(rect, Degrees(0), Degrees(90), false);
87
88 canvas.DrawPath(builder.TakePath(), paint);
89 ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
90 }
91
92 TEST_P(AiksTest, CanRenderStrokePathWithCubicLine) {
93 Canvas canvas;
94
95 Paint paint;
96 paint.color = Color::Red();
97 paint.style = Paint::Style::kStroke;
98 paint.stroke_width = 20;
99
100 PathBuilder builder;
101 builder.AddCubicCurve({0, 200}, {50, 400}, {350, 0}, {400, 200});
102
103 canvas.DrawPath(builder.TakePath(), paint);
104 ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
105 }
106
107 TEST_P(AiksTest, CanRenderDifferencePaths) {
108 Canvas canvas;
109
110 Paint paint;
111 paint.color = Color::Red();
112
113 PathBuilder builder;
114
115 PathBuilder::RoundingRadii radii;
116 radii.top_left = {50, 25};
117 radii.top_right = {25, 50};
118 radii.bottom_right = {50, 25};
119 radii.bottom_left = {25, 50};
120
121 builder.AddRoundedRect(Rect::MakeXYWH(100, 100, 200, 200), radii);
122 builder.AddCircle({200, 200}, 50);
123 auto path = builder.TakePath(FillType::kOdd);
124
125 canvas.DrawImage(
126 std::make_shared<Image>(CreateTextureForFixture("boston.jpg")), {10, 10},
127 Paint{});
128 canvas.DrawPath(path, paint);
129
130 ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
131 }
132
133 // Regression test for https://github.com/flutter/flutter/issues/134816.
134 //
135 // It should be possible to draw 3 lines, and not have an implicit close path.
136 TEST_P(AiksTest, CanDrawAnOpenPath) {
137 Canvas canvas;
138
139 // Starting at (50, 50), draw lines from:
140 // 1. (50, height)
141 // 2. (width, height)
142 // 3. (width, 50)
143 PathBuilder builder;
144 builder.MoveTo({50, 50});
145 builder.LineTo({50, 100});
146 builder.LineTo({100, 100});
147 builder.LineTo({100, 50});
148
149 Paint paint;
150 paint.color = Color::Red();
151 paint.style = Paint::Style::kStroke;
152 paint.stroke_width = 10;
153
154 canvas.DrawPath(builder.TakePath(), paint);
155
156 ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
157 }
158
159 TEST_P(AiksTest, CanDrawAnOpenPathThatIsntARect) {
160 Canvas canvas;
161
162 // Draw a stroked path that is explicitly closed to verify
163 // It doesn't become a rectangle.
164 PathBuilder builder;
165 builder.MoveTo({50, 50});
166 builder.LineTo({520, 120});
167 builder.LineTo({300, 310});
168 builder.LineTo({100, 50});
169 builder.Close();
170
171 Paint paint;
172 paint.color = Color::Red();
173 paint.style = Paint::Style::kStroke;
174 paint.stroke_width = 10;
175
176 canvas.DrawPath(builder.TakePath(), paint);
177
178 ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
179 }
180
181 TEST_P(AiksTest, SolidStrokesRenderCorrectly) {
182 // Compare with https://fiddle.skia.org/c/027392122bec8ac2b5d5de00a4b9bbe2
183 auto callback = [&](AiksContext& renderer) -> std::optional<Picture> {
184 static Color color = Color::Black().WithAlpha(0.5);
185 static float scale = 3;
186 static bool add_circle_clip = true;
187
188 if (AiksTest::ImGuiBegin("Controls", nullptr,
189 ImGuiWindowFlags_AlwaysAutoResize)) {
190 ImGui::ColorEdit4("Color", reinterpret_cast<float*>(&color));
191 ImGui::SliderFloat("Scale", &scale, 0, 6);
192 ImGui::Checkbox("Circle clip", &add_circle_clip);
193 ImGui::End();
194 }
195
196 Canvas canvas;
197 canvas.Scale(GetContentScale());
198 Paint paint;
199
200 paint.color = Color::White();
201 canvas.DrawPaint(paint);
202
203 paint.color = color;
204 paint.style = Paint::Style::kStroke;
205 paint.stroke_width = 10;
206
207 Path path = PathBuilder{}
208 .MoveTo({20, 20})
209 .QuadraticCurveTo({60, 20}, {60, 60})
210 .Close()
211 .MoveTo({60, 20})
212 .QuadraticCurveTo({60, 60}, {20, 60})
213 .TakePath();
214
215 canvas.Scale(Vector2(scale, scale));
216
217 if (add_circle_clip) {
218 static PlaygroundPoint circle_clip_point_a(Point(60, 300), 20,
219 Color::Red());
220 static PlaygroundPoint circle_clip_point_b(Point(600, 300), 20,
221 Color::Red());
222 auto [handle_a, handle_b] =
223 DrawPlaygroundLine(circle_clip_point_a, circle_clip_point_b);
224
225 auto screen_to_canvas = canvas.GetCurrentTransform().Invert();
226 Point point_a = screen_to_canvas * handle_a * GetContentScale();
227 Point point_b = screen_to_canvas * handle_b * GetContentScale();
228
229 Point middle = (point_a + point_b) / 2;
230 auto radius = point_a.GetDistance(middle);
231 canvas.ClipPath(PathBuilder{}.AddCircle(middle, radius).TakePath());
232 }
233
234 for (auto join : {Join::kBevel, Join::kRound, Join::kMiter}) {
235 paint.stroke_join = join;
236 for (auto cap : {Cap::kButt, Cap::kSquare, Cap::kRound}) {
237 paint.stroke_cap = cap;
238 canvas.DrawPath(path, paint);
239 canvas.Translate({80, 0});
240 }
241 canvas.Translate({-240, 60});
242 }
243
244 return canvas.EndRecordingAsPicture();
245 };
246
247 ASSERT_TRUE(OpenPlaygroundHere(callback));
248 }
249
250 TEST_P(AiksTest, DrawLinesRenderCorrectly) {
251 Canvas canvas;
252 canvas.Scale(GetContentScale());
253 Paint paint;
254 paint.color = Color::Blue();
255 paint.stroke_width = 10;
256
257 auto draw = [&canvas](Paint& paint) {
258 for (auto cap : {Cap::kButt, Cap::kSquare, Cap::kRound}) {
259 paint.stroke_cap = cap;
260 Point origin = {100, 100};
261 Point p0 = {50, 0};
262 Point p1 = {150, 0};
263 canvas.DrawLine({150, 100}, {250, 100}, paint);
264 for (int d = 15; d < 90; d += 15) {
265 Matrix m = Matrix::MakeRotationZ(Degrees(d));
266 canvas.DrawLine(origin + m * p0, origin + m * p1, paint);
267 }
268 canvas.DrawLine({100, 150}, {100, 250}, paint);
269 canvas.DrawCircle({origin}, 35, paint);
270
271 canvas.DrawLine({250, 250}, {250, 250}, paint);
272
273 canvas.Translate({250, 0});
274 }
275 canvas.Translate({-750, 250});
276 };
277
278 std::vector<Color> colors = {
279 Color{0x1f / 255.0, 0.0, 0x5c / 255.0, 1.0},
280 Color{0x5b / 255.0, 0.0, 0x60 / 255.0, 1.0},
281 Color{0x87 / 255.0, 0x01 / 255.0, 0x60 / 255.0, 1.0},
282 Color{0xac / 255.0, 0x25 / 255.0, 0x53 / 255.0, 1.0},
283 Color{0xe1 / 255.0, 0x6b / 255.0, 0x5c / 255.0, 1.0},
284 Color{0xf3 / 255.0, 0x90 / 255.0, 0x60 / 255.0, 1.0},
285 Color{0xff / 255.0, 0xb5 / 255.0, 0x6b / 250.0, 1.0}};
286 std::vector<Scalar> stops = {
287 0.0,
288 (1.0 / 6.0) * 1,
289 (1.0 / 6.0) * 2,
290 (1.0 / 6.0) * 3,
291 (1.0 / 6.0) * 4,
292 (1.0 / 6.0) * 5,
293 1.0,
294 };
295
296 auto texture = CreateTextureForFixture("airplane.jpg",
297 /*enable_mipmapping=*/true);
298
299 draw(paint);
300
301 paint.color_source = ColorSource::MakeRadialGradient(
302 {100, 100}, 200, std::move(colors), std::move(stops),
303 Entity::TileMode::kMirror, {});
304 draw(paint);
305
306 paint.color_source = ColorSource::MakeImage(
307 texture, Entity::TileMode::kRepeat, Entity::TileMode::kRepeat, {},
308 Matrix::MakeTranslation({-150, 75}));
309 draw(paint);
310
311 ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
312 }
313
314 TEST_P(AiksTest, DrawRectStrokesRenderCorrectly) {
315 Canvas canvas;
316 Paint paint;
317 paint.color = Color::Red();
318 paint.style = Paint::Style::kStroke;
319 paint.stroke_width = 10;
320
321 canvas.Translate({100, 100});
322 canvas.DrawPath(
323 PathBuilder{}.AddRect(Rect::MakeSize(Size{100, 100})).TakePath(),
324 {paint});
325
326 ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
327 }
328
329 TEST_P(AiksTest, DrawRectStrokesWithBevelJoinRenderCorrectly) {
330 Canvas canvas;
331 Paint paint;
332 paint.color = Color::Red();
333 paint.style = Paint::Style::kStroke;
334 paint.stroke_width = 10;
335 paint.stroke_join = Join::kBevel;
336
337 canvas.Translate({100, 100});
338 canvas.DrawPath(
339 PathBuilder{}.AddRect(Rect::MakeSize(Size{100, 100})).TakePath(),
340 {paint});
341
342 ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
343 }
344
345 TEST_P(AiksTest, CanDrawMultiContourConvexPath) {
346 PathBuilder builder = {};
347 for (auto i = 0; i < 10; i++) {
348 if (i % 2 == 0) {
349 builder.AddCircle(Point(100 + 50 * i, 100 + 50 * i), 100);
350 } else {
351 builder.MoveTo({100.f + 50.f * i - 100, 100.f + 50.f * i});
352 builder.LineTo({100.f + 50.f * i, 100.f + 50.f * i - 100});
353 builder.LineTo({100.f + 50.f * i - 100, 100.f + 50.f * i - 100});
354 builder.Close();
355 }
356 }
357 builder.SetConvexity(Convexity::kConvex);
358
359 Canvas canvas;
360 canvas.DrawPath(builder.TakePath(), {.color = Color::Red().WithAlpha(0.4)});
361
362 ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
363 }
364
365 TEST_P(AiksTest, ArcWithZeroSweepAndBlur) {
366 Canvas canvas;
367 canvas.Scale(GetContentScale());
368
369 Paint paint;
370 paint.color = Color::Red();
371 std::vector<Color> colors = {Color{1.0, 0.0, 0.0, 1.0},
372 Color{0.0, 0.0, 0.0, 1.0}};
373 std::vector<Scalar> stops = {0.0, 1.0};
374 paint.color_source = ColorSource::MakeSweepGradient(
375 {100, 100}, Degrees(45), Degrees(135), std::move(colors),
376 std::move(stops), Entity::TileMode::kMirror, {});
377 paint.mask_blur_descriptor = Paint::MaskBlurDescriptor{
378 .style = FilterContents::BlurStyle::kNormal,
379 .sigma = Sigma(20),
380 };
381
382 PathBuilder builder;
383 builder.AddArc(Rect::MakeXYWH(10, 10, 100, 100), Degrees(0), Degrees(0),
384 false);
385 canvas.DrawPath(builder.TakePath(), paint);
386
387 // Check that this empty picture can be created without crashing.
388 canvas.EndRecordingAsPicture();
389 }
390
391 TEST_P(AiksTest, CanRenderClips) {
392 Canvas canvas;
393 Paint paint;
394 paint.color = Color::Fuchsia();
395 canvas.ClipPath(
396 PathBuilder{}.AddRect(Rect::MakeXYWH(0, 0, 500, 500)).TakePath());
397 canvas.DrawPath(PathBuilder{}.AddCircle({500, 500}, 250).TakePath(), paint);
398 ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
399 }
400
401 TEST_P(AiksTest, CanRenderOverlappingMultiContourPath) {
402 Canvas canvas;
403
404 Paint paint;
405 paint.color = Color::Red();
406
407 PathBuilder::RoundingRadii radii;
408 radii.top_left = {50, 50};
409 radii.top_right = {50, 50};
410 radii.bottom_right = {50, 50};
411 radii.bottom_left = {50, 50};
412
413 const Scalar kTriangleHeight = 100;
414 canvas.Translate(Vector2(200, 200));
415 // Form a path similar to the Material drop slider value indicator. Both
416 // shapes should render identically side-by-side.
417 {
418 auto path =
419 PathBuilder{}
420 .MoveTo({0, kTriangleHeight})
421 .LineTo({-kTriangleHeight / 2.0f, 0})
422 .LineTo({kTriangleHeight / 2.0f, 0})
423 .Close()
424 .AddRoundedRect(
425 Rect::MakeXYWH(-kTriangleHeight / 2.0f, -kTriangleHeight / 2.0f,
426 kTriangleHeight, kTriangleHeight),
427 radii)
428 .TakePath();
429
430 canvas.DrawPath(path, paint);
431 }
432 canvas.Translate(Vector2(100, 0));
433 {
434 auto path =
435 PathBuilder{}
436 .MoveTo({0, kTriangleHeight})
437 .LineTo({-kTriangleHeight / 2.0f, 0})
438 .LineTo({0, -10})
439 .LineTo({kTriangleHeight / 2.0f, 0})
440 .Close()
441 .AddRoundedRect(
442 Rect::MakeXYWH(-kTriangleHeight / 2.0f, -kTriangleHeight / 2.0f,
443 kTriangleHeight, kTriangleHeight),
444 radii)
445 .TakePath();
446
447 canvas.DrawPath(path, paint);
448 }
449
450 ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
451 }
452
453 } // namespace testing
454 } // namespace impeller
impeller::Paint::stroke_cap
Cap stroke_cap
Definition: paint.h:60
impeller::Color::Blue
static constexpr Color Blue()
Definition: color.h:268
impeller::AiksPlayground
Definition: aiks_playground.h:18
impeller::Canvas::EndRecordingAsPicture
Picture EndRecordingAsPicture()
Definition: canvas.cc:756
impeller::Cap::kRound
@ kRound
impeller::Cap::kSquare
@ kSquare
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::AiksContext
Definition: aiks_context.h:20
impeller::Color::Red
static constexpr Color Red()
Definition: color.h:264
impeller::Paint::Style::kStroke
@ kStroke
aiks_unittests.h
impeller::Paint
Definition: paint.h:23
impeller::FillType::kOdd
@ kOdd
impeller::TRect< Scalar >::MakeXYWH
constexpr static TRect MakeXYWH(Type x, Type y, Type width, Type height)
Definition: rect.h:136
impeller::Color
Definition: color.h:124
impeller::Paint::color
Color color
Definition: paint.h:55
impeller::Canvas
Definition: canvas.h:58
impeller::PathBuilder
Definition: path_builder.h:14
impeller::Paint::MaskBlurDescriptor::style
FilterContents::BlurStyle style
Definition: paint.h:40
impeller::Vector2
Point Vector2
Definition: point.h:320
impeller::Paint::MaskBlurDescriptor
Definition: paint.h:39
impeller::ColorSource::MakeSweepGradient
static ColorSource MakeSweepGradient(Point center, Degrees start_angle, Degrees end_angle, std::vector< Color > colors, std::vector< Scalar > stops, Entity::TileMode tile_mode, Matrix effect_transform)
Definition: color_source.cc:138
impeller::PathBuilder::AddRoundedRect
PathBuilder & AddRoundedRect(Rect rect, RoundingRadii radii)
Definition: path_builder.cc:145
impeller::Color::Fuchsia
static constexpr Color Fuchsia()
Definition: color.h:458
impeller::ColorSource::MakeImage
static ColorSource MakeImage(std::shared_ptr< Texture > texture, Entity::TileMode x_tile_mode, Entity::TileMode y_tile_mode, SamplerDescriptor sampler_descriptor, Matrix effect_transform)
Definition: color_source.cc:163
impeller::FilterContents::BlurStyle::kNormal
@ kNormal
Blurred inside and outside.
impeller::PathBuilder::SetConvexity
PathBuilder & SetConvexity(Convexity value)
Definition: path_builder.cc:80
impeller::Cap::kButt
@ kButt
impeller::Entity::TileMode::kRepeat
@ kRepeat
impeller::Matrix::MakeTranslation
static constexpr Matrix MakeTranslation(const Vector3 &t)
Definition: matrix.h:95
impeller::Canvas::DrawLine
void DrawLine(const Point &p0, const Point &p1, const Paint &paint)
Definition: canvas.cc:430
impeller::Paint::color_source
ColorSource color_source
Definition: paint.h:56
impeller::Canvas::GetCurrentTransform
const Matrix & GetCurrentTransform() const
Definition: canvas.cc:247
impeller::PathBuilder::AddRect
PathBuilder & AddRect(Rect rect)
Definition: path_builder.cc:112
impeller::PathBuilder::RoundingRadii::bottom_right
Point bottom_right
Definition: path_builder.h:109
impeller::Join::kMiter
@ kMiter
impeller::Canvas::Concat
void Concat(const Matrix &transform)
Definition: canvas.cc:231
impeller::kPiOver2
constexpr float kPiOver2
Definition: constants.h:32
impeller::Canvas::DrawImage
void DrawImage(const std::shared_ptr< Image > &image, Point offset, const Paint &paint, SamplerDescriptor sampler={})
Definition: canvas.cc:703
impeller::Entity::TileMode::kMirror
@ kMirror
path_builder.h
impeller::PathBuilder::RoundingRadii
Definition: path_builder.h:105
impeller::TSize< Scalar >
impeller::Point
TPoint< Scalar > Point
Definition: point.h:316
impeller::Canvas::Scale
void Scale(const Vector2 &scale)
Definition: canvas.cc:264
impeller::Path
Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments....
Definition: path.h:51
impeller::ColorFilter::MakeBlend
static std::shared_ptr< ColorFilter > MakeBlend(BlendMode blend_mode, Color color)
Definition: color_filter.cc:23
widgets.h
impeller::Paint::style
Style style
Definition: paint.h:63
impeller::Color::WithAlpha
constexpr Color WithAlpha(Scalar new_alpha) const
Definition: color.h:270
impeller::Canvas::DrawCircle
void DrawCircle(const Point &center, Scalar radius, const Paint &paint)
Definition: canvas.cc:515
impeller::PathBuilder::LineTo
PathBuilder & LineTo(Point point, bool relative=false)
Insert a line from the current position to point.
Definition: path_builder.cc:47
impeller::Color::White
static constexpr Color White()
Definition: color.h:256
impeller::PathBuilder::AddCubicCurve
PathBuilder & AddCubicCurve(Point p1, Point cp1, Point cp2, Point p2)
Move to point p1, then insert a cubic curve from p1 to p2 with control points cp1 and cp2.
Definition: path_builder.cc:103
impeller::Sigma
In filters that use Gaussian distributions, "sigma" is a size of one standard deviation in terms of t...
Definition: sigma.h:32
impeller::PathBuilder::RoundingRadii::top_left
Point top_left
Definition: path_builder.h:106
impeller::Radians
Definition: scalar.h:38
impeller::PathBuilder::AddLine
PathBuilder & AddLine(const Point &p1, const Point &p2)
Move to point p1, then insert a line from p1 to p2.
Definition: path_builder.cc:419
canvas.h
impeller::Canvas::DrawPath
void DrawPath(const Path &path, const Paint &paint)
Definition: canvas.cc:292
impeller::PathBuilder::TakePath
Path TakePath(FillType fill=FillType::kNonZero)
Definition: path_builder.cc:22
impeller::Canvas::DrawPaint
void DrawPaint(const Paint &paint)
Definition: canvas.cc:302
impeller::Join::kRound
@ kRound
impeller::Matrix::Invert
Matrix Invert() const
Definition: matrix.cc:97
impeller::ColorSource::MakeRadialGradient
static ColorSource MakeRadialGradient(Point center, Scalar radius, std::vector< Color > colors, std::vector< Scalar > stops, Entity::TileMode tile_mode, Matrix effect_transform)
Definition: color_source.cc:108
impeller::Close
void Close(PathBuilder *builder)
Definition: tessellator.cc:36
impeller::Join::kBevel
@ kBevel
impeller::Matrix::MakeRotationZ
static Matrix MakeRotationZ(Radians r)
Definition: matrix.h:209
impeller::PathBuilder::Close
PathBuilder & Close()
Definition: path_builder.cc:40
impeller::LineTo
void LineTo(PathBuilder *builder, Scalar x, Scalar y)
Definition: tessellator.cc:22
impeller::PlaygroundPoint
Definition: widgets.h:17
impeller::TRect< Scalar >::MakeSize
constexpr static TRect MakeSize(const TSize< U > &size)
Definition: rect.h:146
impeller::PathBuilder::RoundingRadii::top_right
Point top_right
Definition: path_builder.h:108
impeller::testing::TEST_P
TEST_P(AiksTest, CanRenderMaskBlurHugeSigma)
Definition: aiks_blur_unittests.cc:23
impeller::TPoint< Scalar >
impeller::PathBuilder::MoveTo
PathBuilder & MoveTo(Point point, bool relative=false)
Definition: path_builder.cc:33
impeller::Color::Black
static constexpr Color Black()
Definition: color.h:258
impeller::PathBuilder::RoundingRadii::bottom_left
Point bottom_left
Definition: path_builder.h:107
impeller::BlendMode::kSourceIn
@ kSourceIn
scale
const Scalar scale
Definition: stroke_path_geometry.cc:297
impeller::AiksPlayground::ImGuiBegin
static bool ImGuiBegin(const char *name, bool *p_open, ImGuiWindowFlags flags)
Definition: aiks_playground.cc:59
impeller::Degrees
Definition: scalar.h:46
impeller::PathBuilder::AddCircle
PathBuilder & AddCircle(const Point &center, Scalar radius)
Definition: path_builder.cc:130
impeller::Color::AliceBlue
static constexpr Color AliceBlue()
Definition: color.h:274
impeller::TPoint::GetDistance
constexpr Type GetDistance(const TPoint &p) const
Definition: point.h:200
impeller::Convexity::kConvex
@ kConvex
impeller
Definition: aiks_blur_unittests.cc:20
impeller::Paint::mask_blur_descriptor
std::optional< MaskBlurDescriptor > mask_blur_descriptor
Definition: paint.h:69
impeller::Paint::stroke_width
Scalar stroke_width
Definition: paint.h:59
impeller::TRect
Definition: rect.h:122
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::PathBuilder::AddArc
PathBuilder & AddArc(const Rect &oval_bounds, Radians start, Radians sweep, bool use_center=false)
Definition: path_builder.cc:313
impeller::DrawPlaygroundLine
std::tuple< Point, Point > DrawPlaygroundLine(PlaygroundPoint &point_a, PlaygroundPoint &point_b)
Definition: widgets.cc:50
impeller::Paint::stroke_join
Join stroke_join
Definition: paint.h:61
impeller::Canvas::Translate
void Translate(const Vector3 &offset)
Definition: canvas.cc:260
impeller::Canvas::ClipPath
void ClipPath(const Path &path, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:539