595 .
MoveTo({359.934, 96.6335})
596 .CubicCurveTo({358.189, 96.7055}, {356.436, 96.7908},
598 .CubicCurveTo({354.571, 96.8953}, {354.469, 96.9016},
600 .CubicCurveTo({352.672, 97.0038}, {350.969, 97.113},
602 .CubicCurveTo({349.048, 97.2506}, {348.836, 97.2678},
604 .CubicCurveTo({347.019, 97.4014}, {345.407, 97.5299},
606 .CubicCurveTo({343.428, 97.704}, {343.065, 97.7402},
608 .CubicCurveTo({341.221, 97.9086}, {339.736, 98.0505},
610 .CubicCurveTo({337.702, 98.2642}, {337.156, 98.3292},
612 .CubicCurveTo({335.284, 98.5356}, {333.956, 98.6837},
614 .CubicCurveTo({332.495, 98.8635}, {332.366, 98.8818},
616 .
LineTo({332.237, 102.601})
617 .
LineTo({321.778, 102.601})
618 .
LineTo({321.778, 100.382})
619 .CubicCurveTo({321.572, 100.413}, {321.367, 100.442},
621 .CubicCurveTo({319.22, 100.79}, {317.277, 101.123},
623 .CubicCurveTo({315.322, 101.481}, {315.311, 101.482},
625 .
LineTo({310.017, 105.94})
626 .
LineTo({309.779, 105.427})
627 .
LineTo({314.403, 101.651})
628 .CubicCurveTo({314.391, 101.653}, {314.379, 101.656},
630 .CubicCurveTo({312.528, 102.001}, {310.687, 102.366},
632 .CubicCurveTo({307.85, 102.955}, {306.855, 103.182}, {305.859, 103.4})
633 .CubicCurveTo({305.048, 103.579}, {304.236, 103.75},
635 .
LineTo({299.105, 107.578})
636 .
LineTo({298.867, 107.065})
637 .
LineTo({302.394, 104.185})
638 .
LineTo({302.412, 104.171})
639 .CubicCurveTo({301.388, 104.409}, {300.366, 104.67},
641 .CubicCurveTo({298.618, 105.1}, {297.89, 105.269}, {297.165, 105.455})
642 .CubicCurveTo({295.262, 105.94}, {293.36, 106.445},
644 .CubicCurveTo({291.132, 107.072}, {290.802, 107.163},
646 .CubicCurveTo({289.463, 107.544}, {288.455, 107.839},
648 .CubicCurveTo({286.476, 108.431}, {285.506, 108.73},
650 .CubicCurveTo({283.674, 109.304}, {282.812, 109.579},
652 .CubicCurveTo({281.177, 110.112}, {280.406, 110.377},
654 .CubicCurveTo({278.458, 111.037}, {277.256, 111.449},
656 .CubicCurveTo({276.76, 111.622}, {276.716, 111.637},
658 .CubicCurveTo({275.017, 112.239}, {273.365, 112.836},
660 .
LineTo({271.717, 113.449})
661 .CubicCurveTo({271.496, 113.496}, {271.238, 113.559},
663 .CubicCurveTo({270.893, 113.645}, {270.822, 113.663},
665 .CubicCurveTo({270.468, 113.755}, {270.169, 113.834},
667 .CubicCurveTo({269.789, 113.94}, {269.732, 113.957},
669 .CubicCurveTo({269.391, 114.053}, {269.081, 114.143},
671 .CubicCurveTo({268.628, 114.276}, {268.5, 114.314},
673 .CubicCurveTo({268.172, 114.412}, {267.959, 114.478},
675 .CubicCurveTo({263.349, 115.964}, {258.058, 117.695},
677 .CubicCurveTo({253.556, 119.255}, {253.547, 119.258},
679 .CubicCurveTo({251.844, 119.849}, {250.056, 120.474},
681 .CubicCurveTo({248, 121.197}, {247.812, 121.264}, {247.621, 121.331})
682 .CubicCurveTo({247.079, 121.522}, {246.531, 121.715},
684 .CubicCurveTo({245.554, 122.06}, {245.126, 122.212},
686 .CubicCurveTo({244.071, 122.586}, {243.437, 122.811},
688 .CubicCurveTo({242.189, 123.255}, {241.58, 123.472},
690 .CubicCurveTo({240.659, 123.801}, {240.357, 123.909},
692 .CubicCurveTo({239.12, 124.351}, {238.18, 124.687}, {237.22, 125.032})
693 .
LineTo({237.164, 125.003})
694 .CubicCurveTo({236.709, 125.184}, {236.262, 125.358},
696 .CubicCurveTo({235.413, 125.68}, {234.994, 125.832},
698 .CubicCurveTo({234.592, 125.977}, {234.591, 125.977},
700 .CubicCurveTo({222.206, 130.435}, {207.708, 135.753},
702 .CubicCurveTo({162.77, 151.336}, {122.17, 156.894}, {84.1123, 160})
707 .CubicCurveTo({359.978, 96.6317}, {359.956, 96.6326},
710 .
MoveTo({337.336, 124.143})
711 .CubicCurveTo({337.274, 122.359}, {338.903, 121.511},
713 .CubicCurveTo({338.903, 121.511}, {338.96, 123.303},
716 .
MoveTo({340.082, 121.849})
717 .CubicCurveTo({340.074, 121.917}, {340.062, 121.992},
719 .CubicCurveTo({340.039, 122.109}, {340.031, 122.142},
721 .CubicCurveTo({340.005, 122.26}, {339.98, 122.346},
723 .CubicCurveTo({339.941, 122.473}, {339.931, 122.507},
725 .CubicCurveTo({339.873, 122.672}, {339.819, 122.804},
727 .CubicCurveTo({339.747, 122.944}, {339.743, 122.949},
729 .CubicCurveTo({339.674, 123.08}, {339.593, 123.205},
731 .CubicCurveTo({339.473, 123.366}, {339.441, 123.401},
733 .CubicCurveTo({339.332, 123.534}, {339.243, 123.625},
735 .CubicCurveTo({339.105, 123.75}, {339.068, 123.786},
737 .CubicCurveTo({338.881, 123.937}, {338.724, 124.048},
739 .CubicCurveTo({338.532, 123.959}, {338.554, 123.79},
741 .CubicCurveTo({338.58, 123.625}, {338.58, 123.625}, {338.58, 123.625})
742 .CubicCurveTo({338.607, 123.455}, {338.65, 123.299},
744 .CubicCurveTo({338.708, 123.14}, {338.71, 123.127},
746 .CubicCurveTo({338.769, 122.971}, {338.833, 122.838},
748 .CubicCurveTo({338.911, 122.702}, {338.916, 122.69200000000001},
750 .CubicCurveTo({338.996, 122.557}, {339.072, 122.444},
752 .CubicCurveTo({339.161, 122.333}, {339.166, 122.326},
754 .CubicCurveTo({339.256, 122.215}, {339.339, 122.12},
756 .CubicCurveTo({339.428, 122.033}, {339.431, 122.03},
758 .CubicCurveTo({339.785, 121.687}, {340.106, 121.511},
760 .CubicCurveTo({340.106, 121.511}, {340.107, 121.645},
763 .
MoveTo({340.678, 113.245})
764 .CubicCurveTo({340.594, 113.488}, {340.356, 113.655},
766 .CubicCurveTo({339.817, 113.948}, {339.465, 114.059},
768 .CubicCurveTo({338.251, 114.379}, {337.34, 114.516},
770 .CubicCurveTo({335.761, 114.516}, {335.072, 114.527},
772 .CubicCurveTo({334.125, 114.508}, {333.862, 114.462},
774 .CubicCurveTo({332.865, 114.318}, {332.096, 114.184},
776 .CubicCurveTo({330.979, 113.695}, {330.442, 113.34},
778 .CubicCurveTo({331.135, 111.755}, {333.219, 112.946},
780 .CubicCurveTo({334.54, 113.816}, {334.554, 113.8}, {334.569, 113.784})
781 .CubicCurveTo({333.38, 112.708}, {331.749, 110.985},
783 .CubicCurveTo({333.769, 109.82}, {334.713, 111.93},
785 .CubicCurveTo({334.915, 111.889}, {334.59, 109.636},
787 .CubicCurveTo({336.733, 109.636}, {336.408, 111.889},
789 .CubicCurveTo({336.609, 111.93}, {337.553, 109.82},
791 .CubicCurveTo({339.574, 110.984}, {337.942, 112.708},
793 .CubicCurveTo({336.768, 113.8}, {336.782, 113.816},
795 .CubicCurveTo({338.104, 112.946}, {340.187, 111.755},
797 .CubicCurveTo({340.71, 112.95}, {340.728, 113.102},
800 .
MoveTo({346.357, 106.771})
801 .CubicCurveTo({346.295, 104.987}, {347.924, 104.139},
803 .CubicCurveTo({347.924, 104.139}, {347.982, 105.931},
806 .
MoveTo({347.56, 106.771})
807 .CubicCurveTo({347.498, 104.987}, {349.127, 104.139},
809 .CubicCurveTo({349.127, 104.139}, {349.185, 105.931},
816 ASSERT_TRUE(OpenPlaygroundHere(std::move(entity)));
1053 CreateTextureForFixture(
"boston.jpg",
true);
1054 ASSERT_TRUE(boston);
1057 const char* input_type_names[] = {
"Texture",
"Solid Color"};
1058 const char* blur_type_names[] = {
"Image blur",
"Mask blur"};
1059 const char* pass_variation_names[] = {
"New"};
1060 const char* blur_style_names[] = {
"Normal",
"Solid",
"Outer",
"Inner"};
1061 const char* tile_mode_names[] = {
"Clamp",
"Repeat",
"Mirror",
"Decal"};
1070 static int selected_input_type = 0;
1072 static int selected_blur_type = 0;
1073 static int selected_pass_variation = 0;
1074 static bool combined_sigma =
false;
1075 static float blur_amount_coarse[2] = {0, 0};
1076 static float blur_amount_fine[2] = {10, 10};
1077 static int selected_blur_style = 0;
1078 static int selected_tile_mode = 3;
1079 static Color cover_color(1, 0, 0, 0.2);
1080 static Color bounds_color(0, 1, 0, 0.1);
1081 static float offset[2] = {500, 400};
1082 static float rotation = 0;
1083 static float scale[2] = {0.65, 0.65};
1084 static float skew[2] = {0, 0};
1085 static float path_rect[4] = {0, 0,
1086 static_cast<float>(boston->GetSize().width),
1087 static_cast<float>(boston->GetSize().height)};
1089 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
1091 ImGui::Combo(
"Input type", &selected_input_type, input_type_names,
1092 sizeof(input_type_names) /
sizeof(
char*));
1093 if (selected_input_type == 0) {
1094 ImGui::SliderFloat(
"Input opacity", &input_color.
alpha, 0, 1);
1096 ImGui::ColorEdit4(
"Input color",
1097 reinterpret_cast<float*
>(&input_color));
1099 ImGui::Combo(
"Blur type", &selected_blur_type, blur_type_names,
1100 sizeof(blur_type_names) /
sizeof(
char*));
1101 if (selected_blur_type == 0) {
1102 ImGui::Combo(
"Pass variation", &selected_pass_variation,
1103 pass_variation_names,
1104 sizeof(pass_variation_names) /
sizeof(
char*));
1106 ImGui::Checkbox(
"Combined sigma", &combined_sigma);
1107 if (combined_sigma) {
1108 ImGui::SliderFloat(
"Sigma (coarse)", blur_amount_coarse, 0, 1000);
1109 ImGui::SliderFloat(
"Sigma (fine)", blur_amount_fine, 0, 10);
1110 blur_amount_coarse[1] = blur_amount_coarse[0];
1111 blur_amount_fine[1] = blur_amount_fine[0];
1113 ImGui::SliderFloat2(
"Sigma (coarse)", blur_amount_coarse, 0, 1000);
1114 ImGui::SliderFloat2(
"Sigma (fine)", blur_amount_fine, 0, 10);
1116 ImGui::Combo(
"Blur style", &selected_blur_style, blur_style_names,
1117 sizeof(blur_style_names) /
sizeof(
char*));
1118 ImGui::Combo(
"Tile mode", &selected_tile_mode, tile_mode_names,
1119 sizeof(tile_mode_names) /
sizeof(
char*));
1120 ImGui::ColorEdit4(
"Cover color",
reinterpret_cast<float*
>(&cover_color));
1121 ImGui::ColorEdit4(
"Bounds color",
1122 reinterpret_cast<float*
>(&bounds_color));
1123 ImGui::SliderFloat2(
"Translation",
offset, 0,
1124 pass.GetRenderTargetSize().width);
1125 ImGui::SliderFloat(
"Rotation", &rotation, 0,
kPi * 2);
1126 ImGui::SliderFloat2(
"Scale",
scale, 0, 3);
1127 ImGui::SliderFloat2(
"Skew", skew, -3, 3);
1128 ImGui::SliderFloat4(
"Path XYWH", path_rect, -1000, 1000);
1132 auto blur_sigma_x =
Sigma{blur_amount_coarse[0] + blur_amount_fine[0]};
1133 auto blur_sigma_y =
Sigma{blur_amount_coarse[1] + blur_amount_fine[1]};
1135 std::shared_ptr<Contents> input;
1139 Rect::MakeXYWH(path_rect[0], path_rect[1], path_rect[2], path_rect[3]);
1140 if (selected_input_type == 0) {
1141 auto texture = std::make_shared<TextureContents>();
1143 texture->SetDestinationRect(input_rect);
1148 input_size = input_rect.GetSize();
1150 auto fill = std::make_shared<SolidColorContents>();
1151 fill->SetColor(input_color);
1156 input_size = input_rect.GetSize();
1159 std::shared_ptr<FilterContents> blur;
1160 switch (selected_pass_variation) {
1162 blur = std::make_shared<GaussianBlurFilterContents>(
1163 blur_sigma_x.sigma, blur_sigma_y.sigma,
1164 tile_modes[selected_tile_mode], blur_styles[selected_blur_style],
1171 tile_modes[selected_tile_mode], blur_styles[selected_blur_style]);
1178 blur_styles[selected_blur_style]);
1187 auto target_contents = selected_blur_type == 0 ? blur : mask_blur;
1193 entity.
Render(context, pass);
1202 cover_entity.
Render(context, pass);
1206 std::optional<Rect> target_contents_coverage =
1208 if (target_contents_coverage.has_value()) {
1211 .
AddRect(target_contents->GetCoverage(entity).value())
1216 bounds_entity.
Render(context, pass);
1221 ASSERT_TRUE(OpenPlaygroundHere(
callback));