22#include "gtest/gtest.h"
35#include "third_party/imgui/imgui.h"
42 Color(components[0], components[1], components[2], components[3])));
52 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
58 SkTextBlob::MakeFromString(
"Hello", CreateTestFont())),
60 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
68 const float stops[2] = {0.0, 1.0};
71 {0.0, 0.0}, {300.0, 300.0}, 2, colors.data(), stops,
78 SkTextBlob::MakeFromString(
"Hello World", CreateTestFont())),
80 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
86 SkTextBlob::MakeFromString(
"Hello", CreateTestFont())),
91 save_paint.
setAlpha(
static_cast<uint8_t
>(255 * alpha));
92 builder.
SaveLayer(std::nullopt, &save_paint);
95 "Hello with half alpha", CreateTestFontOfSize(100))),
98 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
102 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
106 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
155 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
160 static float start_angle = 45;
161 static float sweep_angle = 270;
162 static float stroke_width = 10;
165 static int selected_cap = 0;
166 const char* cap_names[] = {
"Butt",
"Round",
"Square"};
169 if (IsPlaygroundEnabled()) {
170 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
171 ImGui::SliderFloat(
"Start angle", &start_angle, -360, 360);
172 ImGui::SliderFloat(
"Sweep angle", &sweep_angle, -360, 360);
173 ImGui::SliderFloat(
"Stroke width", &stroke_width, 0, 300);
174 ImGui::Combo(
"Cap", &selected_cap, cap_names,
175 sizeof(cap_names) /
sizeof(
char*));
180 switch (selected_cap) {
202 Vector2 scale = GetContentScale();
203 builder.
Scale(scale.
x, scale.
y);
216 return builder.
Build();
218 ASSERT_TRUE(OpenPlaygroundHere(
callback));
229 static float stroke_width = 10.0f;
230 static int selected_stroke_type = 0;
231 static int selected_join_type = 0;
232 const char* stroke_types[] = {
"Butte",
"Round",
"Square"};
233 const char* join_type[] = {
"kMiter",
"Round",
"kBevel"};
235 if (IsPlaygroundEnabled()) {
236 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
237 ImGui::Combo(
"Cap", &selected_stroke_type, stroke_types,
238 sizeof(stroke_types) /
sizeof(
char*));
239 ImGui::Combo(
"Join", &selected_join_type, join_type,
240 sizeof(join_type) /
sizeof(
char*));
241 ImGui::SliderFloat(
"Stroke Width", &stroke_width, 10.0f, 50.0f);
247 switch (selected_stroke_type) {
261 switch (selected_join_type) {
280 builder.
Scale(1.5f, 1.5f);
399 return builder.
Build();
401 ASSERT_TRUE(OpenPlaygroundHere(
callback));
415 path_builder.
SetFillType(flutter::DlPathFillType::kOdd);
418 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
445 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
449 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
478 SkTextBlob::MakeFromString(
"Testing", CreateTestFont())),
482 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
493 "stoked about stroked text", CreateTestFont())),
496 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
503 auto const& text_blob = SkTextBlob::MakeFromString(
"00000", CreateTestFont());
523 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
527 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
536 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
540 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
562 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
566 const float invert_color_matrix[20] = {
572 auto texture = CreateTextureForFixture(
"boston.jpg");
587 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
591 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
594 static float sigma[] = {10, 10};
596 if (IsPlaygroundEnabled()) {
597 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
598 ImGui::SliderFloat2(
"Sigma", sigma, 0, 100);
611 return builder.
Build();
614 ASSERT_TRUE(OpenPlaygroundHere(
callback));
618 auto texture = CreateTextureForFixture(
"boston.jpg");
622 auto dilate = std::make_shared<flutter::DlDilateImageFilter>(10.0, 10.0);
623 auto erode = std::make_shared<flutter::DlErodeImageFilter>(10.0, 10.0);
624 auto open = std::make_shared<flutter::DlComposeImageFilter>(dilate, erode);
625 auto close = std::make_shared<flutter::DlComposeImageFilter>(erode, dilate);
634 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
638 auto texture = CreateTextureForFixture(
"boston.jpg");
639 const float inner_color_matrix[20] = {
645 const float outer_color_matrix[20] = {
651 auto inner_color_filter =
653 auto outer_color_filter =
657 auto compose = std::make_shared<flutter::DlComposeImageFilter>(outer, inner);
664 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
668 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
671 static float sigma[] = {10, 10};
672 static float ctm_scale = 1;
673 static bool use_bounds =
true;
674 static bool draw_circle =
true;
675 static bool add_clip =
true;
677 if (IsPlaygroundEnabled()) {
678 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
679 ImGui::SliderFloat2(
"Sigma", sigma, 0, 100);
680 ImGui::SliderFloat(
"Scale", &ctm_scale, 0, 10);
683 "If everything is working correctly, none of the options below "
684 "should impact the filter's appearance.");
685 ImGui::Checkbox(
"Use SaveLayer bounds", &use_bounds);
686 ImGui::Checkbox(
"Draw child element", &draw_circle);
687 ImGui::Checkbox(
"Add pre-clip", &add_clip);
693 Vector2 scale = ctm_scale * GetContentScale();
694 builder.
Scale(scale.
x, scale.
y);
699 std::optional<DlRect> bounds;
716 builder.
SaveLayer(bounds,
nullptr, &filter);
731 return builder.
Build();
734 ASSERT_TRUE(OpenPlaygroundHere(
callback));
738 auto texture = CreateTextureForFixture(
"kalimba.jpg");
739 const char* tile_mode_names[] = {
"Clamp",
"Repeat",
"Mirror",
"Decal"};
745 static float sigma = 20;
746 static float bg_scale = 2.1;
747 static float rotate_degree = 0;
748 static float bounds_scale = 1.0;
749 static bool use_bounds =
true;
750 static int selected_tile_mode = 0;
752 if (IsPlaygroundEnabled()) {
753 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
754 ImGui::SliderFloat(
"Background scale", &bg_scale, 0, 10);
755 ImGui::SliderFloat(
"Sigma", &sigma, 0, 100);
756 ImGui::SliderFloat(
"Bounds rotate", &rotate_degree, -200, 200);
757 ImGui::SliderFloat(
"Bounds scale", &bounds_scale, 0.5f, 2.0f);
758 ImGui::Combo(
"Tile mode", &selected_tile_mode, tile_mode_names,
759 sizeof(tile_mode_names) /
sizeof(
char*));
761 ImGui::Checkbox(
"Bounded blur", &use_bounds);
770 Point p1_global = content_scale_transform * p1_raw;
771 Point p2_global = content_scale_transform * p2_raw;
776 builder.
Scale(bg_scale, bg_scale);
787 Point p1 = inverse_transform * p1_global;
788 Point p2 = inverse_transform * p2_global;
796 save_paint.
setBlendMode(flutter::DlBlendMode::kSrcOver);
798 std::optional<DlRect> blur_bounds;
800 blur_bounds = bounds;
803 sigma, sigma, tile_modes[selected_tile_mode], blur_bounds);
804 builder.
SaveLayer(std::nullopt, &save_paint, &filter);
808 return builder.
Build();
811 ASSERT_TRUE(OpenPlaygroundHere(
callback));
816 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
822 size.height * 3 / 4),
825 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
832 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
838 size.height * 3 / 4),
841 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
848 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
854 size.height * 3 / 4),
857 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
863 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
869 size.height * 3 / 4),
872 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
878 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
884 size.height * 3 / 4),
887 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
893 auto texture = CreateTextureForFixture(
"nine_patch_corners.png");
899 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
903 auto texture = CreateTextureForFixture(
"nine_patch2.png");
906 flutter::DlBlendMode::kSrcIn);
915 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
929 std::vector<flutter::DlStrokeCap> caps = {
939 for (
auto cap : caps) {
950 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
955 std::vector<flutter::DlStrokeCap> caps = {
967 for (
auto cap : caps) {
973 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
980 auto content_scale = GetContentScale() * 0.8;
981 builder.
Scale(content_scale.x, content_scale.y);
983 constexpr size_t star_spikes = 5;
984 constexpr DlScalar half_spike_rotation =
kPi / star_spikes;
987 constexpr DlScalar outer_radius = radius + spike_size;
988 constexpr DlScalar inner_radius = radius - spike_size;
989 std::array<DlPoint, star_spikes * 2> star;
990 for (
size_t i = 0;
i < star_spikes;
i++) {
991 const DlScalar rotation = half_spike_rotation *
i * 2;
992 star[
i * 2] =
DlPoint(50 + std::sin(rotation) * outer_radius,
993 50 - std::cos(rotation) * outer_radius);
995 DlPoint(50 + std::sin(rotation + half_spike_rotation) * inner_radius,
996 50 - std::cos(rotation + half_spike_rotation) * inner_radius);
999 std::array<DlPath, 4> paths = {
1009 for (
size_t x = 0;
x < paths.size();
x++) {
1011 for (
size_t y = 0;
y < 6;
y++) {
1021 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1026 std::vector<flutter::DlStrokeCap> caps = {
1043 for (
auto cap : caps) {
1052 builder.
DrawRect(
path.GetBounds().Expand(5, 5), outline_paint);
1055 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1059 auto boston = CreateTextureForFixture(
"boston.jpg");
1062 static int selected_matrix_type = 0;
1063 const char* matrix_type_names[] = {
"Matrix",
"Local Matrix"};
1065 static float ctm_translation[2] = {200, 200};
1066 static float ctm_scale[2] = {0.65, 0.65};
1067 static float ctm_skew[2] = {0, 0};
1069 static bool enable =
true;
1070 static float translation[2] = {100, 100};
1071 static float scale[2] = {0.8, 0.8};
1072 static float skew[2] = {0.2, 0.2};
1074 static bool enable_savelayer =
true;
1076 if (IsPlaygroundEnabled()) {
1077 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
1078 ImGui::Combo(
"Filter type", &selected_matrix_type, matrix_type_names,
1079 sizeof(matrix_type_names) /
sizeof(
char*));
1081 ImGui::TextWrapped(
"Current Transform");
1082 ImGui::SliderFloat2(
"CTM Translation", ctm_translation, 0, 1000);
1083 ImGui::SliderFloat2(
"CTM Scale", ctm_scale, 0, 3);
1084 ImGui::SliderFloat2(
"CTM Skew", ctm_skew, -3, 3);
1087 "MatrixFilter and LocalMatrixFilter modify the CTM in the same way. "
1088 "The only difference is that MatrixFilter doesn't affect the effect "
1089 "transform, whereas LocalMatrixFilter does.");
1092 ImGui::Checkbox(
"Enable", &enable);
1093 ImGui::SliderFloat2(
"Filter Translation", translation, 0, 1000);
1094 ImGui::SliderFloat2(
"Filter Scale", scale, 0, 3);
1095 ImGui::SliderFloat2(
"Filter Skew", skew, -3, 3);
1098 "Rendering the filtered image within a layer can expose bounds "
1099 "issues. If the rendered image gets cut off when this setting is "
1100 "enabled, there's a coverage bug in the filter.");
1101 ImGui::Checkbox(
"Render in layer", &enable_savelayer);
1108 if (enable_savelayer) {
1109 builder.
SaveLayer(std::nullopt,
nullptr);
1112 auto content_scale = GetContentScale();
1113 builder.
Scale(content_scale.x, content_scale.y);
1117 ctm_scale[0], ctm_skew[0], 0.0f, ctm_translation[0],
1118 ctm_skew[1], ctm_scale[1], 0.0f, ctm_translation[1],
1124 auto filter_matrix =
1126 skew[1], scale[1], 0.0f, translation[1],
1127 0.0f, 0.0f, 1.0f, 0.0f,
1128 0.0f, 0.0f, 0.0f, 1.0f);
1131 switch (selected_matrix_type) {
1139 auto internal_filter =
1153 if (enable_savelayer) {
1157 return builder.
Build();
1160 ASSERT_TRUE(OpenPlaygroundHere(
callback));
1165 static float translation[2] = {0, 0};
1166 static bool enable_save_layer =
true;
1168 if (IsPlaygroundEnabled()) {
1169 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
1170 ImGui::SliderFloat2(
"Translation", translation, -130, 130);
1171 ImGui::Checkbox(
"Enable save layer", &enable_save_layer);
1177 builder.
Scale(2.0, 2.0);
1189 Matrix translate_matrix =
1191 if (enable_save_layer) {
1203 filter_matrix.
Scale({0.2f, 0.2f});
1216 return builder.
Build();
1219 ASSERT_TRUE(OpenPlaygroundHere(
callback));
1233 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1241 const float stops[2] = {0.0, 1.0};
1277 auto texture = CreateTextureForFixture(
"table_mountain_nx.png");
1285 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1292 builder.
SaveLayer(std::nullopt,
nullptr);
1303 builder.
SaveLayer(std::nullopt,
nullptr);
1314 builder.
SaveLayer(std::nullopt,
nullptr);
1325 builder.
SaveLayer(std::nullopt,
nullptr);
1336 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1341 const float green_color_matrix[20] = {
1347 const float blue_color_matrix[20] = {
1353 auto green_color_filter =
1355 auto blue_color_filter =
1357 auto blue_image_filter =
1365 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1369 auto blur_filter = std::make_shared<flutter::DlBlurMaskFilter>(
1376 std::array<float, 2> stops = {0, 1};
1377 auto texture = CreateTextureForFixture(
"airplane.jpg");
1379 std::array<std::shared_ptr<flutter::DlColorSource>, 2> color_sources = {
1391 for (
const auto& color_source : color_sources) {
1413 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1418 std::vector<flutter::DlStrokeJoin> joins = {
1436 builder.
Scale(0.8, 0.8);
1437 for (
auto join : joins) {
1452 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1457 static float filled_radius = 100.0;
1458 static float filled_alpha = 255.0;
1459 static float filled_scale[2] = {1.0, 1.0};
1460 static float stroked_radius = 20.0;
1461 static float stroke_width = 10.0;
1462 static float stroke_width_fine = 0.0;
1463 static float stroked_alpha = 255.0;
1464 static float stroked_scale[2] = {1.0, 1.0};
1466 if (IsPlaygroundEnabled()) {
1467 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
1468 ImGui::SliderFloat(
"Filled Radius", &filled_radius, 0, 500);
1469 ImGui::SliderFloat(
"Filled Alpha", &filled_alpha, 0, 255);
1470 ImGui::SliderFloat2(
"Filled Scale", filled_scale, 0, 10.0);
1471 ImGui::SliderFloat(
"Stroked Radius", &stroked_radius, 0, 500);
1472 ImGui::SliderFloat(
"Stroked Width", &stroke_width, 0, 500);
1473 ImGui::SliderFloat(
"Stroked Width Fine", &stroke_width_fine, 0, 5);
1474 ImGui::SliderFloat(
"Stroked Alpha", &stroked_alpha, 0, 10.0);
1475 ImGui::SliderFloat2(
"Stroked Scale", stroked_scale, 0, 10.0);
1485 builder.
Scale(filled_scale[0], filled_scale[1]);
1493 builder.
Scale(stroked_scale[0], stroked_scale[1]);
1496 return builder.
Build();
1499 ASSERT_TRUE(OpenPlaygroundHere(
callback));
1561 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1565 std::vector<const char*> blend_mode_names;
1566 std::vector<flutter::DlBlendMode> blend_mode_values;
1568 const std::vector<std::tuple<const char*, flutter::DlBlendMode>> blends = {
1570 {
"Clear", flutter::DlBlendMode::kClear},
1571 {
"Source", flutter::DlBlendMode::kSrc},
1572 {
"Destination", flutter::DlBlendMode::kDst},
1573 {
"SourceOver", flutter::DlBlendMode::kSrcOver},
1574 {
"DestinationOver", flutter::DlBlendMode::kDstOver},
1575 {
"SourceIn", flutter::DlBlendMode::kSrcIn},
1576 {
"DestinationIn", flutter::DlBlendMode::kDstIn},
1577 {
"SourceOut", flutter::DlBlendMode::kSrcOut},
1578 {
"DestinationOut", flutter::DlBlendMode::kDstOut},
1579 {
"SourceATop", flutter::DlBlendMode::kSrcATop},
1580 {
"DestinationATop", flutter::DlBlendMode::kDstATop},
1581 {
"Xor", flutter::DlBlendMode::kXor},
1582 {
"Plus", flutter::DlBlendMode::kPlus},
1583 {
"Modulate", flutter::DlBlendMode::kModulate},
1585 {
"Screen", flutter::DlBlendMode::kScreen},
1586 {
"Overlay", flutter::DlBlendMode::kOverlay},
1587 {
"Darken", flutter::DlBlendMode::kDarken},
1588 {
"Lighten", flutter::DlBlendMode::kLighten},
1589 {
"ColorDodge", flutter::DlBlendMode::kColorDodge},
1590 {
"ColorBurn", flutter::DlBlendMode::kColorBurn},
1591 {
"HardLight", flutter::DlBlendMode::kHardLight},
1592 {
"SoftLight", flutter::DlBlendMode::kSoftLight},
1593 {
"Difference", flutter::DlBlendMode::kDifference},
1594 {
"Exclusion", flutter::DlBlendMode::kExclusion},
1595 {
"Multiply", flutter::DlBlendMode::kMultiply},
1596 {
"Hue", flutter::DlBlendMode::kHue},
1597 {
"Saturation", flutter::DlBlendMode::kSaturation},
1598 {
"Color", flutter::DlBlendMode::kColor},
1599 {
"Luminosity", flutter::DlBlendMode::kLuminosity},
1601 assert(blends.size() ==
1602 static_cast<size_t>(flutter::DlBlendMode::kLastMode) + 1);
1603 for (
const auto& [
name,
mode] : blends) {
1604 blend_mode_names.push_back(
name);
1605 blend_mode_values.push_back(
mode);
1610 static int current_blend_index = 3;
1611 static float dst_alpha = 1;
1612 static float src_alpha = 1;
1613 static float color0[4] = {1.0f, 0.0f, 0.0f, 1.0f};
1614 static float color1[4] = {0.0f, 1.0f, 0.0f, 1.0f};
1615 static float color2[4] = {0.0f, 0.0f, 1.0f, 1.0f};
1616 static float src_color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
1618 if (IsPlaygroundEnabled()) {
1619 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
1620 ImGui::ListBox(
"Blending mode", ¤t_blend_index,
1621 blend_mode_names.data(), blend_mode_names.size());
1622 ImGui::SliderFloat(
"Source alpha", &src_alpha, 0, 1);
1623 ImGui::ColorEdit4(
"Color A", color0);
1624 ImGui::ColorEdit4(
"Color B", color1);
1625 ImGui::ColorEdit4(
"Color C", color2);
1626 ImGui::ColorEdit4(
"Source Color", src_color);
1627 ImGui::SliderFloat(
"Destination alpha", &dst_alpha, 0, 1);
1631 std::vector<DlPoint> positions = {
DlPoint(100, 300),
1634 std::vector<flutter::DlColor> colors = {
1641 nullptr, colors.data());
1647 builder.
DrawVertices(vertices, blend_mode_values[current_blend_index],
1649 return builder.
Build();
1652 ASSERT_TRUE(OpenPlaygroundHere(
callback));
1665 const float stops[2] = {0.0, 1.0};
1667 {100.0, 100.0}, {300.0, 300.0}, 2, colors.data(), stops,
1675 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1681 Vector2 scale = GetContentScale();
1682 builder.
Scale(scale.
x, scale.
y);
1694 for (
int x = 1;
x <= 4;
x++) {
1695 for (
int y = 1;
y <= 4;
y++) {
1704 auto normal_filter =
1714 for (
int x = 1;
x <= 4;
x++) {
1715 for (
int y = 1;
y <= 4;
y++) {
1722 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
void ClipRect(const DlRect &rect, DlClipOp clip_op=DlClipOp::kIntersect, bool is_aa=false) override
void DrawVertices(const std::shared_ptr< DlVertices > &vertices, DlBlendMode mode, const DlPaint &paint) override
void DrawImageNine(const sk_sp< DlImage > &image, const DlIRect ¢er, const DlRect &dst, DlFilterMode filter, const DlPaint *paint=nullptr) override
void DrawRoundRect(const DlRoundRect &rrect, const DlPaint &paint) override
void DrawArc(const DlRect &bounds, DlScalar start, DlScalar sweep, bool useCenter, const DlPaint &paint) override
void DrawShadow(const DlPath &path, const DlColor color, const DlScalar elevation, bool transparent_occluder, DlScalar dpr) override
Draws the shadow of the given |path| rendered in the provided |color| (which is only consulted for it...
void DrawImage(const sk_sp< DlImage > &image, const DlPoint &point, DlImageSampling sampling, const DlPaint *paint=nullptr) override
void DrawColor(DlColor color, DlBlendMode mode) override
void DrawCircle(const DlPoint ¢er, DlScalar radius, const DlPaint &paint) override
void SaveLayer(const std::optional< DlRect > &bounds, const DlPaint *paint=nullptr, const DlImageFilter *backdrop=nullptr, std::optional< int64_t > backdrop_id=std::nullopt) override
void DrawLine(const DlPoint &p0, const DlPoint &p1, const DlPaint &paint) override
void ClipRoundRect(const DlRoundRect &rrect, DlClipOp clip_op=DlClipOp::kIntersect, bool is_aa=false) override
void DrawText(const std::shared_ptr< DlText > &text, DlScalar x, DlScalar y, const DlPaint &paint) override
void Scale(DlScalar sx, DlScalar sy) override
void Translate(DlScalar tx, DlScalar ty) override
void DrawPaint(const DlPaint &paint) override
sk_sp< DisplayList > Build()
void DrawPath(const DlPath &path, const DlPaint &paint) override
void DrawPoints(DlPointMode mode, uint32_t count, const DlPoint pts[], const DlPaint &paint) override
void DrawDiffRoundRect(const DlRoundRect &outer, const DlRoundRect &inner, const DlPaint &paint) override
void Transform(const DlMatrix &matrix) override
void DrawRect(const DlRect &rect, const DlPaint &paint) override
std::shared_ptr< DlImageFilter > shared() const override
static std::shared_ptr< DlMaskFilter > Make(DlBlurStyle style, SkScalar sigma, bool respect_ctm=true)
static std::shared_ptr< const DlColorFilter > MakeBlend(DlColor color, DlBlendMode mode)
static std::shared_ptr< const DlColorFilter > MakeLinearToSrgbGamma()
static std::shared_ptr< const DlColorFilter > MakeMatrix(const float matrix[20])
static std::shared_ptr< const DlColorFilter > MakeSrgbToLinearGamma()
static std::shared_ptr< DlColorSource > MakeSweep(DlPoint center, DlScalar start, DlScalar end, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
static std::shared_ptr< DlColorSource > MakeImage(const sk_sp< const DlImage > &image, DlTileMode horizontal_tile_mode, DlTileMode vertical_tile_mode, DlImageSampling sampling=DlImageSampling::kLinear, const DlMatrix *matrix=nullptr)
static std::shared_ptr< DlColorSource > MakeLinear(const DlPoint start_point, const DlPoint end_point, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
static std::shared_ptr< DlColorSource > MakeRadial(DlPoint center, DlScalar radius, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
static std::shared_ptr< DlImageFilter > MakeColorFilter(const std::shared_ptr< const DlColorFilter > &filter)
static std::shared_ptr< DlImageFilter > Make(const DlMatrix &matrix, DlImageSampling sampling)
DlPaint & setColor(DlColor color)
DlPaint & setStrokeCap(DlStrokeCap cap)
DlPaint & setStrokeWidth(float width)
DlPaint & setAlpha(uint8_t alpha)
DlPaint & setStrokeMiter(float miter)
DlPaint & setBlendMode(DlBlendMode mode)
DlPaint & setImageFilter(std::nullptr_t filter)
DlPaint & setMaskFilter(std::nullptr_t filter)
DlPaint & setDrawStyle(DlDrawStyle style)
DlPaint & setStrokeJoin(DlStrokeJoin join)
DlPaint & setColorFilter(std::nullptr_t filter)
DlPaint & setColorSource(std::nullptr_t source)
DlPathBuilder & LineTo(DlPoint p2)
Draw a line from the current point to the indicated point p2.
DlPathBuilder & MoveTo(DlPoint p2)
Start a new contour that will originate at the indicated point p2.
DlPathBuilder & SetFillType(DlPathFillType fill_type)
Set the fill type that should be used to determine the interior of this path to the indicated |fill_t...
const DlPath TakePath()
Returns the path constructed by this path builder and resets its internal state to the default state ...
DlPathBuilder & AddCircle(DlPoint center, DlScalar radius)
Append a closed circular contour to the path centered on the provided point at the provided radius.
DlPathBuilder & QuadraticCurveTo(DlPoint cp, DlPoint p2)
Draw a quadratic bezier curve from the current point to the indicated point p2, using the indicated p...
DlPathBuilder & CubicCurveTo(DlPoint cp1, DlPoint cp2, DlPoint p2)
Draw a cubic bezier curve from the current point to the indicated point p2, using the indicated point...
static DlPath MakeLine(const DlPoint a, const DlPoint b)
static DlPath MakeCircle(const DlPoint center, DlScalar radius)
static DlPath MakeRect(const DlRect &rect)
static DlPath MakeRoundRectXY(const DlRect &rect, DlScalar x_radius, DlScalar y_radius, bool counter_clock_wise=false)
static DlPath MakePoly(const DlPoint pts[], int count, bool close, DlPathFillType fill_type=DlPathFillType::kNonZero)
static std::shared_ptr< DlTextImpeller > MakeFromBlob(const sk_sp< SkTextBlob > &blob)
static std::shared_ptr< DlVertices > Make(DlVertexMode mode, int vertex_count, const DlPoint vertices[], const DlPoint texture_coordinates[], const DlColor colors[], int index_count=0, const uint16_t indices[]=nullptr, const DlRect *bounds=nullptr)
Constructs a DlVector with compact inline storage for all of its required and optional lists of data.
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
FlutterVulkanImage * image
FlutterDesktopBinaryReply callback
impeller::Scalar DlScalar
@ kMiter
extends to miter limit
@ kBevel
connects outside edges
@ kButt
no stroke extension
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
@ kLines
draw each separate pair of points as a line segment
@ kPolygon
draw each pair of overlapping points as a line segment
@ kPoints
draw each point separately
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
DEF_SWITCHES_START aot vmservice shared library name
@ kTriangles
The vertices are taken 3 at a time to form a triangle.
@ kStroke
strokes boundary of shapes
@ kFill
fills interior of shapes
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
static constexpr DlScalar kPi
@ kNormal
fuzzy inside and outside
@ kOuter
nothing inside, fuzzy outside
@ kSolid
solid inside, fuzzy outside
TEST_P(AiksTest, DrawAtlasNoColor)
flutter::DlColor toColor(const float *components)
Point DrawPlaygroundPoint(PlaygroundPoint &point)
std::tuple< Point, Point > DrawPlaygroundLine(PlaygroundPoint &point_a, PlaygroundPoint &point_b)
#define INSTANTIATE_PLAYGROUND_SUITE(playground)
static constexpr DlColor kWhite()
static constexpr DlColor kBlue()
static constexpr DlColor kBlack()
static constexpr DlColor kYellow()
static constexpr DlColor kMidGrey()
static constexpr DlColor kRed()
static constexpr DlColor kGreen()
static constexpr DlColor kCyan()
constexpr DlColor modulateOpacity(DlScalar opacity) const
static uint32_t ToIColor(Color color)
Convert this color to a 32-bit representation.
static constexpr Color White()
static constexpr Color Red()
A 4x4 matrix using column-major storage.
static constexpr Matrix MakeTranslation(const Vector3 &t)
constexpr Matrix Translate(const Vector3 &t) const
static constexpr Matrix MakeRow(Scalar m0, Scalar m1, Scalar m2, Scalar m3, Scalar m4, Scalar m5, Scalar m6, Scalar m7, Scalar m8, Scalar m9, Scalar m10, Scalar m11, Scalar m12, Scalar m13, Scalar m14, Scalar m15)
constexpr Matrix Scale(const Vector3 &s) const
static Matrix MakeRotationZ(Radians r)
static constexpr Matrix MakeScale(const Vector3 &s)
static RoundRect MakeRectXY(const Rect &rect, Scalar x_radius, Scalar y_radius)
static constexpr TRect MakeWH(Type width, Type height)
static constexpr TRect MakeXYWH(Type x, Type y, Type width, Type height)
constexpr TRect Scale(Type scale) const
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
std::vector< Point > points