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));
726 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
732 size.height * 3 / 4),
735 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
742 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
748 size.height * 3 / 4),
751 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
758 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
764 size.height * 3 / 4),
767 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
773 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
779 size.height * 3 / 4),
782 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
788 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
794 size.height * 3 / 4),
797 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
803 auto texture = CreateTextureForFixture(
"nine_patch_corners.png");
809 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
813 auto texture = CreateTextureForFixture(
"nine_patch2.png");
816 flutter::DlBlendMode::kSrcIn);
825 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
839 std::vector<flutter::DlStrokeCap> caps = {
849 for (
auto cap : caps) {
860 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
865 std::vector<flutter::DlStrokeCap> caps = {
877 for (
auto cap : caps) {
883 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
890 auto content_scale = GetContentScale() * 0.8;
891 builder.
Scale(content_scale.x, content_scale.y);
893 constexpr size_t star_spikes = 5;
894 constexpr DlScalar half_spike_rotation =
kPi / star_spikes;
897 constexpr DlScalar outer_radius = radius + spike_size;
898 constexpr DlScalar inner_radius = radius - spike_size;
899 std::array<DlPoint, star_spikes * 2> star;
900 for (
size_t i = 0;
i < star_spikes;
i++) {
901 const DlScalar rotation = half_spike_rotation *
i * 2;
902 star[
i * 2] =
DlPoint(50 + std::sin(rotation) * outer_radius,
903 50 - std::cos(rotation) * outer_radius);
905 DlPoint(50 + std::sin(rotation + half_spike_rotation) * inner_radius,
906 50 - std::cos(rotation + half_spike_rotation) * inner_radius);
909 std::array<DlPath, 4> paths = {
919 for (
size_t x = 0;
x < paths.size();
x++) {
921 for (
size_t y = 0;
y < 6;
y++) {
931 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
936 std::vector<flutter::DlStrokeCap> caps = {
953 for (
auto cap : caps) {
962 builder.
DrawRect(
path.GetBounds().Expand(5, 5), outline_paint);
965 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
969 auto boston = CreateTextureForFixture(
"boston.jpg");
972 static int selected_matrix_type = 0;
973 const char* matrix_type_names[] = {
"Matrix",
"Local Matrix"};
975 static float ctm_translation[2] = {200, 200};
976 static float ctm_scale[2] = {0.65, 0.65};
977 static float ctm_skew[2] = {0, 0};
979 static bool enable =
true;
980 static float translation[2] = {100, 100};
981 static float scale[2] = {0.8, 0.8};
982 static float skew[2] = {0.2, 0.2};
984 static bool enable_savelayer =
true;
986 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
988 ImGui::Combo(
"Filter type", &selected_matrix_type, matrix_type_names,
989 sizeof(matrix_type_names) /
sizeof(
char*));
991 ImGui::TextWrapped(
"Current Transform");
992 ImGui::SliderFloat2(
"CTM Translation", ctm_translation, 0, 1000);
993 ImGui::SliderFloat2(
"CTM Scale", ctm_scale, 0, 3);
994 ImGui::SliderFloat2(
"CTM Skew", ctm_skew, -3, 3);
997 "MatrixFilter and LocalMatrixFilter modify the CTM in the same way. "
998 "The only difference is that MatrixFilter doesn't affect the effect "
999 "transform, whereas LocalMatrixFilter does.");
1002 ImGui::Checkbox(
"Enable", &enable);
1003 ImGui::SliderFloat2(
"Filter Translation", translation, 0, 1000);
1004 ImGui::SliderFloat2(
"Filter Scale", scale, 0, 3);
1005 ImGui::SliderFloat2(
"Filter Skew", skew, -3, 3);
1008 "Rendering the filtered image within a layer can expose bounds "
1009 "issues. If the rendered image gets cut off when this setting is "
1010 "enabled, there's a coverage bug in the filter.");
1011 ImGui::Checkbox(
"Render in layer", &enable_savelayer);
1018 if (enable_savelayer) {
1019 builder.
SaveLayer(std::nullopt,
nullptr);
1022 auto content_scale = GetContentScale();
1023 builder.
Scale(content_scale.x, content_scale.y);
1027 ctm_scale[0], ctm_skew[0], 0.0f, ctm_translation[0],
1028 ctm_skew[1], ctm_scale[1], 0.0f, ctm_translation[1],
1034 auto filter_matrix =
1036 skew[1], scale[1], 0.0f, translation[1],
1037 0.0f, 0.0f, 1.0f, 0.0f,
1038 0.0f, 0.0f, 0.0f, 1.0f);
1041 switch (selected_matrix_type) {
1049 auto internal_filter =
1063 if (enable_savelayer) {
1067 return builder.
Build();
1070 ASSERT_TRUE(OpenPlaygroundHere(
callback));
1075 static float translation[2] = {0, 0};
1076 static bool enable_save_layer =
true;
1078 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
1079 ImGui::SliderFloat2(
"Translation", translation, -130, 130);
1080 ImGui::Checkbox(
"Enable save layer", &enable_save_layer);
1085 builder.
Scale(2.0, 2.0);
1097 Matrix translate_matrix =
1099 if (enable_save_layer) {
1111 filter_matrix.
Scale({0.2f, 0.2f});
1124 return builder.
Build();
1127 ASSERT_TRUE(OpenPlaygroundHere(
callback));
1141 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1149 const float stops[2] = {0.0, 1.0};
1185 auto texture = CreateTextureForFixture(
"table_mountain_nx.png");
1193 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1200 builder.
SaveLayer(std::nullopt,
nullptr);
1211 builder.
SaveLayer(std::nullopt,
nullptr);
1222 builder.
SaveLayer(std::nullopt,
nullptr);
1233 builder.
SaveLayer(std::nullopt,
nullptr);
1244 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1249 const float green_color_matrix[20] = {
1255 const float blue_color_matrix[20] = {
1261 auto green_color_filter =
1263 auto blue_color_filter =
1265 auto blue_image_filter =
1273 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1277 auto blur_filter = std::make_shared<flutter::DlBlurMaskFilter>(
1284 std::array<float, 2> stops = {0, 1};
1285 auto texture = CreateTextureForFixture(
"airplane.jpg");
1287 std::array<std::shared_ptr<flutter::DlColorSource>, 2> color_sources = {
1299 for (
const auto& color_source : color_sources) {
1321 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1326 std::vector<flutter::DlStrokeJoin> joins = {
1344 builder.
Scale(0.8, 0.8);
1345 for (
auto join : joins) {
1360 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1365 static float filled_radius = 100.0;
1366 static float filled_alpha = 255.0;
1367 static float filled_scale[2] = {1.0, 1.0};
1368 static float stroked_radius = 20.0;
1369 static float stroke_width = 10.0;
1370 static float stroked_alpha = 255.0;
1371 static float stroked_scale[2] = {1.0, 1.0};
1373 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
1375 ImGui::SliderFloat(
"Filled Radius", &filled_radius, 0, 500);
1376 ImGui::SliderFloat(
"Filled Alpha", &filled_alpha, 0, 255);
1377 ImGui::SliderFloat2(
"Filled Scale", filled_scale, 0, 10.0);
1378 ImGui::SliderFloat(
"Stroked Radius", &stroked_radius, 0, 10.0);
1379 ImGui::SliderFloat(
"Stroked Width", &stroke_width, 0, 500);
1380 ImGui::SliderFloat(
"Stroked Alpha", &stroked_alpha, 0, 10.0);
1381 ImGui::SliderFloat2(
"Stroked Scale", stroked_scale, 0, 10.0);
1391 builder.
Scale(filled_scale[0], filled_scale[1]);
1399 builder.
Scale(stroked_scale[0], stroked_scale[1]);
1402 return builder.
Build();
1405 ASSERT_TRUE(OpenPlaygroundHere(
callback));
1467 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1471 std::vector<const char*> blend_mode_names;
1472 std::vector<flutter::DlBlendMode> blend_mode_values;
1474 const std::vector<std::tuple<const char*, flutter::DlBlendMode>> blends = {
1476 {
"Clear", flutter::DlBlendMode::kClear},
1477 {
"Source", flutter::DlBlendMode::kSrc},
1478 {
"Destination", flutter::DlBlendMode::kDst},
1479 {
"SourceOver", flutter::DlBlendMode::kSrcOver},
1480 {
"DestinationOver", flutter::DlBlendMode::kDstOver},
1481 {
"SourceIn", flutter::DlBlendMode::kSrcIn},
1482 {
"DestinationIn", flutter::DlBlendMode::kDstIn},
1483 {
"SourceOut", flutter::DlBlendMode::kSrcOut},
1484 {
"DestinationOut", flutter::DlBlendMode::kDstOut},
1485 {
"SourceATop", flutter::DlBlendMode::kSrcATop},
1486 {
"DestinationATop", flutter::DlBlendMode::kDstATop},
1487 {
"Xor", flutter::DlBlendMode::kXor},
1488 {
"Plus", flutter::DlBlendMode::kPlus},
1489 {
"Modulate", flutter::DlBlendMode::kModulate},
1491 {
"Screen", flutter::DlBlendMode::kScreen},
1492 {
"Overlay", flutter::DlBlendMode::kOverlay},
1493 {
"Darken", flutter::DlBlendMode::kDarken},
1494 {
"Lighten", flutter::DlBlendMode::kLighten},
1495 {
"ColorDodge", flutter::DlBlendMode::kColorDodge},
1496 {
"ColorBurn", flutter::DlBlendMode::kColorBurn},
1497 {
"HardLight", flutter::DlBlendMode::kHardLight},
1498 {
"SoftLight", flutter::DlBlendMode::kSoftLight},
1499 {
"Difference", flutter::DlBlendMode::kDifference},
1500 {
"Exclusion", flutter::DlBlendMode::kExclusion},
1501 {
"Multiply", flutter::DlBlendMode::kMultiply},
1502 {
"Hue", flutter::DlBlendMode::kHue},
1503 {
"Saturation", flutter::DlBlendMode::kSaturation},
1504 {
"Color", flutter::DlBlendMode::kColor},
1505 {
"Luminosity", flutter::DlBlendMode::kLuminosity},
1507 assert(blends.size() ==
1508 static_cast<size_t>(flutter::DlBlendMode::kLastMode) + 1);
1509 for (
const auto& [
name,
mode] : blends) {
1510 blend_mode_names.push_back(
name);
1511 blend_mode_values.push_back(
mode);
1516 static int current_blend_index = 3;
1517 static float dst_alpha = 1;
1518 static float src_alpha = 1;
1519 static float color0[4] = {1.0f, 0.0f, 0.0f, 1.0f};
1520 static float color1[4] = {0.0f, 1.0f, 0.0f, 1.0f};
1521 static float color2[4] = {0.0f, 0.0f, 1.0f, 1.0f};
1522 static float src_color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
1524 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
1526 ImGui::ListBox(
"Blending mode", ¤t_blend_index,
1527 blend_mode_names.data(), blend_mode_names.size());
1528 ImGui::SliderFloat(
"Source alpha", &src_alpha, 0, 1);
1529 ImGui::ColorEdit4(
"Color A", color0);
1530 ImGui::ColorEdit4(
"Color B", color1);
1531 ImGui::ColorEdit4(
"Color C", color2);
1532 ImGui::ColorEdit4(
"Source Color", src_color);
1533 ImGui::SliderFloat(
"Destination alpha", &dst_alpha, 0, 1);
1537 std::vector<DlPoint> positions = {
DlPoint(100, 300),
1540 std::vector<flutter::DlColor> colors = {
1547 nullptr, colors.data());
1553 builder.
DrawVertices(vertices, blend_mode_values[current_blend_index],
1555 return builder.
Build();
1558 ASSERT_TRUE(OpenPlaygroundHere(
callback));
1571 const float stops[2] = {0.0, 1.0};
1573 {100.0, 100.0}, {300.0, 300.0}, 2, colors.data(), stops,
1581 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1587 Vector2 scale = GetContentScale();
1588 builder.
Scale(scale.
x, scale.
y);
1600 for (
int x = 1;
x <= 4;
x++) {
1601 for (
int y = 1;
y <= 4;
y++) {
1610 auto normal_filter =
1620 for (
int x = 1;
x <= 4;
x++) {
1621 for (
int y = 1;
y <= 4;
y++) {
1628 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 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)
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
std::vector< Point > points