22#include "gtest/gtest.h"
34#include "third_party/imgui/imgui.h"
41 Color(components[0], components[1], components[2], components[3])));
51 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
57 SkTextBlob::MakeFromString(
"Hello", CreateTestFont())),
59 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
67 const float stops[2] = {0.0, 1.0};
70 2, colors.data(), stops,
76 "Hello World", CreateTestFont())),
78 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
84 SkTextBlob::MakeFromString(
"Hello", CreateTestFont())),
89 save_paint.
setAlpha(
static_cast<uint8_t
>(255 * alpha));
90 builder.
SaveLayer(std::nullopt, &save_paint);
92 "Hello with half alpha", CreateTestFontOfSize(100))),
95 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
99 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
103 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
152 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
157 static float start_angle = 45;
158 static float sweep_angle = 270;
159 static float stroke_width = 10;
162 static int selected_cap = 0;
163 const char* cap_names[] = {
"Butt",
"Round",
"Square"};
166 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
167 ImGui::SliderFloat(
"Start angle", &start_angle, -360, 360);
168 ImGui::SliderFloat(
"Sweep angle", &sweep_angle, -360, 360);
169 ImGui::SliderFloat(
"Stroke width", &stroke_width, 0, 300);
170 ImGui::Combo(
"Cap", &selected_cap, cap_names,
171 sizeof(cap_names) /
sizeof(
char*));
175 switch (selected_cap) {
197 Vector2 scale = GetContentScale();
198 builder.
Scale(scale.
x, scale.
y);
211 return builder.
Build();
213 ASSERT_TRUE(OpenPlaygroundHere(
callback));
224 static float stroke_width = 10.0f;
225 static int selected_stroke_type = 0;
226 static int selected_join_type = 0;
227 const char* stroke_types[] = {
"Butte",
"Round",
"Square"};
228 const char* join_type[] = {
"kMiter",
"Round",
"kBevel"};
230 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
231 ImGui::Combo(
"Cap", &selected_stroke_type, stroke_types,
232 sizeof(stroke_types) /
sizeof(
char*));
233 ImGui::Combo(
"Join", &selected_join_type, join_type,
234 sizeof(join_type) /
sizeof(
char*));
235 ImGui::SliderFloat(
"Stroke Width", &stroke_width, 10.0f, 50.0f);
240 switch (selected_stroke_type) {
254 switch (selected_join_type) {
273 builder.
Scale(1.5f, 1.5f);
392 return builder.
Build();
394 ASSERT_TRUE(OpenPlaygroundHere(
callback));
408 path_builder.
SetFillType(flutter::DlPathFillType::kOdd);
411 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
438 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
442 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
470 "Testing", CreateTestFont())),
474 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
484 "stoked about stroked text", CreateTestFont())),
487 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
494 auto const& text_blob = SkTextBlob::MakeFromString(
"00000", CreateTestFont());
514 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
518 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
527 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
531 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
553 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
557 const float invert_color_matrix[20] = {
563 auto texture = CreateTextureForFixture(
"boston.jpg");
578 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
582 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
585 static float sigma[] = {10, 10};
587 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
588 ImGui::SliderFloat2(
"Sigma", sigma, 0, 100);
600 return builder.
Build();
603 ASSERT_TRUE(OpenPlaygroundHere(
callback));
607 auto texture = CreateTextureForFixture(
"boston.jpg");
611 auto dilate = std::make_shared<flutter::DlDilateImageFilter>(10.0, 10.0);
612 auto erode = std::make_shared<flutter::DlErodeImageFilter>(10.0, 10.0);
613 auto open = std::make_shared<flutter::DlComposeImageFilter>(dilate, erode);
614 auto close = std::make_shared<flutter::DlComposeImageFilter>(erode, dilate);
623 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
627 auto texture = CreateTextureForFixture(
"boston.jpg");
628 const float inner_color_matrix[20] = {
634 const float outer_color_matrix[20] = {
640 auto inner_color_filter =
642 auto outer_color_filter =
646 auto compose = std::make_shared<flutter::DlComposeImageFilter>(outer, inner);
653 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
657 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
660 static float sigma[] = {10, 10};
661 static float ctm_scale = 1;
662 static bool use_bounds =
true;
663 static bool draw_circle =
true;
664 static bool add_clip =
true;
666 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
667 ImGui::SliderFloat2(
"Sigma", sigma, 0, 100);
668 ImGui::SliderFloat(
"Scale", &ctm_scale, 0, 10);
671 "If everything is working correctly, none of the options below should "
672 "impact the filter's appearance.");
673 ImGui::Checkbox(
"Use SaveLayer bounds", &use_bounds);
674 ImGui::Checkbox(
"Draw child element", &draw_circle);
675 ImGui::Checkbox(
"Add pre-clip", &add_clip);
680 Vector2 scale = ctm_scale * GetContentScale();
681 builder.
Scale(scale.
x, scale.
y);
686 std::optional<DlRect> bounds;
703 builder.
SaveLayer(bounds,
nullptr, &filter);
718 return builder.
Build();
721 ASSERT_TRUE(OpenPlaygroundHere(
callback));
725 auto texture = CreateTextureForFixture(
"kalimba.jpg");
726 const char* tile_mode_names[] = {
"Clamp",
"Repeat",
"Mirror",
"Decal"};
732 static float sigma = 20;
733 static float bg_scale = 2.1;
734 static float rotate_degree = 0;
735 static float bounds_scale = 1.0;
736 static bool use_bounds =
true;
737 static int selected_tile_mode = 0;
739 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
740 ImGui::SliderFloat(
"Background scale", &bg_scale, 0, 10);
741 ImGui::SliderFloat(
"Sigma", &sigma, 0, 100);
742 ImGui::SliderFloat(
"Bounds rotate", &rotate_degree, -200, 200);
743 ImGui::SliderFloat(
"Bounds scale", &bounds_scale, 0.5f, 2.0f);
744 ImGui::Combo(
"Tile mode", &selected_tile_mode, tile_mode_names,
745 sizeof(tile_mode_names) /
sizeof(
char*));
747 ImGui::Checkbox(
"Bounded blur", &use_bounds);
755 Point p1_global = content_scale_transform * p1_raw;
756 Point p2_global = content_scale_transform * p2_raw;
761 builder.
Scale(bg_scale, bg_scale);
772 Point p1 = inverse_transform * p1_global;
773 Point p2 = inverse_transform * p2_global;
781 save_paint.
setBlendMode(flutter::DlBlendMode::kSrcOver);
783 std::optional<DlRect> blur_bounds;
785 blur_bounds = bounds;
788 sigma, sigma, tile_modes[selected_tile_mode], blur_bounds);
789 builder.
SaveLayer(std::nullopt, &save_paint, &filter);
793 return builder.
Build();
796 ASSERT_TRUE(OpenPlaygroundHere(
callback));
801 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
807 size.height * 3 / 4),
810 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
817 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
823 size.height * 3 / 4),
826 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
833 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
839 size.height * 3 / 4),
842 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(
"nine_patch_corners.png");
884 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
888 auto texture = CreateTextureForFixture(
"nine_patch2.png");
891 flutter::DlBlendMode::kSrcIn);
900 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
914 std::vector<flutter::DlStrokeCap> caps = {
924 for (
auto cap : caps) {
935 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
940 std::vector<flutter::DlStrokeCap> caps = {
952 for (
auto cap : caps) {
958 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
965 auto content_scale = GetContentScale() * 0.8;
966 builder.
Scale(content_scale.x, content_scale.y);
968 constexpr size_t star_spikes = 5;
969 constexpr DlScalar half_spike_rotation =
kPi / star_spikes;
972 constexpr DlScalar outer_radius = radius + spike_size;
973 constexpr DlScalar inner_radius = radius - spike_size;
974 std::array<DlPoint, star_spikes * 2> star;
975 for (
size_t i = 0;
i < star_spikes;
i++) {
976 const DlScalar rotation = half_spike_rotation *
i * 2;
977 star[
i * 2] =
DlPoint(50 + std::sin(rotation) * outer_radius,
978 50 - std::cos(rotation) * outer_radius);
980 DlPoint(50 + std::sin(rotation + half_spike_rotation) * inner_radius,
981 50 - std::cos(rotation + half_spike_rotation) * inner_radius);
984 std::array<DlPath, 4> paths = {
994 for (
size_t x = 0;
x < paths.size();
x++) {
996 for (
size_t y = 0;
y < 6;
y++) {
1006 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1011 std::vector<flutter::DlStrokeCap> caps = {
1028 for (
auto cap : caps) {
1037 builder.
DrawRect(
path.GetBounds().Expand(5, 5), outline_paint);
1040 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1044 auto boston = CreateTextureForFixture(
"boston.jpg");
1047 static int selected_matrix_type = 0;
1048 const char* matrix_type_names[] = {
"Matrix",
"Local Matrix"};
1050 static float ctm_translation[2] = {200, 200};
1051 static float ctm_scale[2] = {0.65, 0.65};
1052 static float ctm_skew[2] = {0, 0};
1054 static bool enable =
true;
1055 static float translation[2] = {100, 100};
1056 static float scale[2] = {0.8, 0.8};
1057 static float skew[2] = {0.2, 0.2};
1059 static bool enable_savelayer =
true;
1061 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
1063 ImGui::Combo(
"Filter type", &selected_matrix_type, matrix_type_names,
1064 sizeof(matrix_type_names) /
sizeof(
char*));
1066 ImGui::TextWrapped(
"Current Transform");
1067 ImGui::SliderFloat2(
"CTM Translation", ctm_translation, 0, 1000);
1068 ImGui::SliderFloat2(
"CTM Scale", ctm_scale, 0, 3);
1069 ImGui::SliderFloat2(
"CTM Skew", ctm_skew, -3, 3);
1072 "MatrixFilter and LocalMatrixFilter modify the CTM in the same way. "
1073 "The only difference is that MatrixFilter doesn't affect the effect "
1074 "transform, whereas LocalMatrixFilter does.");
1077 ImGui::Checkbox(
"Enable", &enable);
1078 ImGui::SliderFloat2(
"Filter Translation", translation, 0, 1000);
1079 ImGui::SliderFloat2(
"Filter Scale", scale, 0, 3);
1080 ImGui::SliderFloat2(
"Filter Skew", skew, -3, 3);
1083 "Rendering the filtered image within a layer can expose bounds "
1084 "issues. If the rendered image gets cut off when this setting is "
1085 "enabled, there's a coverage bug in the filter.");
1086 ImGui::Checkbox(
"Render in layer", &enable_savelayer);
1093 if (enable_savelayer) {
1094 builder.
SaveLayer(std::nullopt,
nullptr);
1097 auto content_scale = GetContentScale();
1098 builder.
Scale(content_scale.x, content_scale.y);
1102 ctm_scale[0], ctm_skew[0], 0.0f, ctm_translation[0],
1103 ctm_skew[1], ctm_scale[1], 0.0f, ctm_translation[1],
1109 auto filter_matrix =
1111 skew[1], scale[1], 0.0f, translation[1],
1112 0.0f, 0.0f, 1.0f, 0.0f,
1113 0.0f, 0.0f, 0.0f, 1.0f);
1116 switch (selected_matrix_type) {
1124 auto internal_filter =
1138 if (enable_savelayer) {
1142 return builder.
Build();
1145 ASSERT_TRUE(OpenPlaygroundHere(
callback));
1150 static float translation[2] = {0, 0};
1151 static bool enable_save_layer =
true;
1153 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
1154 ImGui::SliderFloat2(
"Translation", translation, -130, 130);
1155 ImGui::Checkbox(
"Enable save layer", &enable_save_layer);
1160 builder.
Scale(2.0, 2.0);
1172 Matrix translate_matrix =
1174 if (enable_save_layer) {
1186 filter_matrix.
Scale({0.2f, 0.2f});
1199 return builder.
Build();
1202 ASSERT_TRUE(OpenPlaygroundHere(
callback));
1216 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1224 const float stops[2] = {0.0, 1.0};
1260 auto texture = CreateTextureForFixture(
"table_mountain_nx.png");
1268 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1275 builder.
SaveLayer(std::nullopt,
nullptr);
1286 builder.
SaveLayer(std::nullopt,
nullptr);
1297 builder.
SaveLayer(std::nullopt,
nullptr);
1308 builder.
SaveLayer(std::nullopt,
nullptr);
1319 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1324 const float green_color_matrix[20] = {
1330 const float blue_color_matrix[20] = {
1336 auto green_color_filter =
1338 auto blue_color_filter =
1340 auto blue_image_filter =
1348 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1352 auto blur_filter = std::make_shared<flutter::DlBlurMaskFilter>(
1359 std::array<float, 2> stops = {0, 1};
1360 auto texture = CreateTextureForFixture(
"airplane.jpg");
1362 std::array<std::shared_ptr<flutter::DlColorSource>, 2> color_sources = {
1374 for (
const auto& color_source : color_sources) {
1396 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1401 std::vector<flutter::DlStrokeJoin> joins = {
1419 builder.
Scale(0.8, 0.8);
1420 for (
auto join : joins) {
1435 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1440 static float filled_radius = 100.0;
1441 static float filled_alpha = 255.0;
1442 static float filled_scale[2] = {1.0, 1.0};
1443 static float stroked_radius = 20.0;
1444 static float stroke_width = 10.0;
1445 static float stroked_alpha = 255.0;
1446 static float stroked_scale[2] = {1.0, 1.0};
1448 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
1450 ImGui::SliderFloat(
"Filled Radius", &filled_radius, 0, 500);
1451 ImGui::SliderFloat(
"Filled Alpha", &filled_alpha, 0, 255);
1452 ImGui::SliderFloat2(
"Filled Scale", filled_scale, 0, 10.0);
1453 ImGui::SliderFloat(
"Stroked Radius", &stroked_radius, 0, 10.0);
1454 ImGui::SliderFloat(
"Stroked Width", &stroke_width, 0, 500);
1455 ImGui::SliderFloat(
"Stroked Alpha", &stroked_alpha, 0, 10.0);
1456 ImGui::SliderFloat2(
"Stroked Scale", stroked_scale, 0, 10.0);
1466 builder.
Scale(filled_scale[0], filled_scale[1]);
1474 builder.
Scale(stroked_scale[0], stroked_scale[1]);
1477 return builder.
Build();
1480 ASSERT_TRUE(OpenPlaygroundHere(
callback));
1542 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1546 std::vector<const char*> blend_mode_names;
1547 std::vector<flutter::DlBlendMode> blend_mode_values;
1549 const std::vector<std::tuple<const char*, flutter::DlBlendMode>> blends = {
1551 {
"Clear", flutter::DlBlendMode::kClear},
1552 {
"Source", flutter::DlBlendMode::kSrc},
1553 {
"Destination", flutter::DlBlendMode::kDst},
1554 {
"SourceOver", flutter::DlBlendMode::kSrcOver},
1555 {
"DestinationOver", flutter::DlBlendMode::kDstOver},
1556 {
"SourceIn", flutter::DlBlendMode::kSrcIn},
1557 {
"DestinationIn", flutter::DlBlendMode::kDstIn},
1558 {
"SourceOut", flutter::DlBlendMode::kSrcOut},
1559 {
"DestinationOut", flutter::DlBlendMode::kDstOut},
1560 {
"SourceATop", flutter::DlBlendMode::kSrcATop},
1561 {
"DestinationATop", flutter::DlBlendMode::kDstATop},
1562 {
"Xor", flutter::DlBlendMode::kXor},
1563 {
"Plus", flutter::DlBlendMode::kPlus},
1564 {
"Modulate", flutter::DlBlendMode::kModulate},
1566 {
"Screen", flutter::DlBlendMode::kScreen},
1567 {
"Overlay", flutter::DlBlendMode::kOverlay},
1568 {
"Darken", flutter::DlBlendMode::kDarken},
1569 {
"Lighten", flutter::DlBlendMode::kLighten},
1570 {
"ColorDodge", flutter::DlBlendMode::kColorDodge},
1571 {
"ColorBurn", flutter::DlBlendMode::kColorBurn},
1572 {
"HardLight", flutter::DlBlendMode::kHardLight},
1573 {
"SoftLight", flutter::DlBlendMode::kSoftLight},
1574 {
"Difference", flutter::DlBlendMode::kDifference},
1575 {
"Exclusion", flutter::DlBlendMode::kExclusion},
1576 {
"Multiply", flutter::DlBlendMode::kMultiply},
1577 {
"Hue", flutter::DlBlendMode::kHue},
1578 {
"Saturation", flutter::DlBlendMode::kSaturation},
1579 {
"Color", flutter::DlBlendMode::kColor},
1580 {
"Luminosity", flutter::DlBlendMode::kLuminosity},
1582 assert(blends.size() ==
1583 static_cast<size_t>(flutter::DlBlendMode::kLastMode) + 1);
1584 for (
const auto& [
name,
mode] : blends) {
1585 blend_mode_names.push_back(
name);
1586 blend_mode_values.push_back(
mode);
1591 static int current_blend_index = 3;
1592 static float dst_alpha = 1;
1593 static float src_alpha = 1;
1594 static float color0[4] = {1.0f, 0.0f, 0.0f, 1.0f};
1595 static float color1[4] = {0.0f, 1.0f, 0.0f, 1.0f};
1596 static float color2[4] = {0.0f, 0.0f, 1.0f, 1.0f};
1597 static float src_color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
1599 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
1601 ImGui::ListBox(
"Blending mode", ¤t_blend_index,
1602 blend_mode_names.data(), blend_mode_names.size());
1603 ImGui::SliderFloat(
"Source alpha", &src_alpha, 0, 1);
1604 ImGui::ColorEdit4(
"Color A", color0);
1605 ImGui::ColorEdit4(
"Color B", color1);
1606 ImGui::ColorEdit4(
"Color C", color2);
1607 ImGui::ColorEdit4(
"Source Color", src_color);
1608 ImGui::SliderFloat(
"Destination alpha", &dst_alpha, 0, 1);
1612 std::vector<DlPoint> positions = {
DlPoint(100, 300),
1615 std::vector<flutter::DlColor> colors = {
1622 nullptr, colors.data());
1628 builder.
DrawVertices(vertices, blend_mode_values[current_blend_index],
1630 return builder.
Build();
1633 ASSERT_TRUE(OpenPlaygroundHere(
callback));
1646 const float stops[2] = {0.0, 1.0};
1648 {100.0, 100.0}, {300.0, 300.0}, 2, colors.data(), stops,
1656 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1662 Vector2 scale = GetContentScale();
1663 builder.
Scale(scale.
x, scale.
y);
1675 for (
int x = 1;
x <= 4;
x++) {
1676 for (
int y = 1;
y <= 4;
y++) {
1685 auto normal_filter =
1695 for (
int x = 1;
x <= 4;
x++) {
1696 for (
int y = 1;
y <= 4;
y++) {
1703 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< DlTextSkia > Make(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