10 #include "third_party/imgui/imgui.h"
40 canvas.
DrawPath(std::move(arrow_stem), paint);
41 canvas.
DrawPath(std::move(arrow_head), paint);
101 builder.
AddCubicCurve({0, 200}, {50, 400}, {350, 0}, {400, 200});
126 std::make_shared<Image>(CreateTextureForFixture(
"boston.jpg")), {10, 10},
128 canvas.
DrawPath(std::move(path), paint);
145 builder.
LineTo({50, 100});
146 builder.
LineTo({100, 100});
147 builder.
LineTo({100, 50});
166 builder.
LineTo({520, 120});
167 builder.
LineTo({300, 310});
168 builder.
LineTo({100, 50});
183 auto callback = [&](
AiksContext& renderer) -> std::optional<Picture> {
185 static float scale = 3;
186 static bool add_circle_clip =
true;
188 ImGui::Begin(
"Controls",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
189 ImGui::ColorEdit4(
"Color",
reinterpret_cast<float*
>(&color));
190 ImGui::SliderFloat(
"Scale", &scale, 0, 6);
191 ImGui::Checkbox(
"Circle clip", &add_circle_clip);
195 canvas.
Scale(GetContentScale());
207 .QuadraticCurveTo({60, 20}, {60, 60})
210 .QuadraticCurveTo({60, 60}, {20, 60})
215 if (add_circle_clip) {
220 Point point_a = screen_to_canvas * handle_a * GetContentScale();
221 Point point_b = screen_to_canvas * handle_b * GetContentScale();
223 Point middle = (point_a + point_b) / 2;
241 ASSERT_TRUE(OpenPlaygroundHere(callback));
246 canvas.
Scale(GetContentScale());
251 auto draw = [&canvas](
Paint& paint) {
254 Point origin = {100, 100};
257 canvas.
DrawLine({150, 100}, {250, 100}, paint);
258 for (
int d = 15; d < 90; d += 15) {
260 canvas.
DrawLine(origin + m * p0, origin + m * p1, paint);
262 canvas.
DrawLine({100, 150}, {100, 250}, paint);
265 canvas.
DrawLine({250, 250}, {250, 250}, paint);
272 std::vector<Color> colors = {
273 Color{0x1f / 255.0, 0.0, 0x5c / 255.0, 1.0},
274 Color{0x5b / 255.0, 0.0, 0x60 / 255.0, 1.0},
275 Color{0x87 / 255.0, 0x01 / 255.0, 0x60 / 255.0, 1.0},
276 Color{0xac / 255.0, 0x25 / 255.0, 0x53 / 255.0, 1.0},
277 Color{0xe1 / 255.0, 0x6b / 255.0, 0x5c / 255.0, 1.0},
278 Color{0xf3 / 255.0, 0x90 / 255.0, 0x60 / 255.0, 1.0},
279 Color{0xff / 255.0, 0xb5 / 255.0, 0x6b / 250.0, 1.0}};
280 std::vector<Scalar> stops = {
290 auto texture = CreateTextureForFixture(
"airplane.jpg",
296 {100, 100}, 200, std::move(colors), std::move(stops),
341 for (
auto i = 0; i < 10; i++) {
345 builder.
MoveTo({100.f + 50.f * i - 100, 100.f + 50.f * i});
346 builder.
LineTo({100.f + 50.f * i, 100.f + 50.f * i - 100});
347 builder.
LineTo({100.f + 50.f * i - 100, 100.f + 50.f * i - 100});
354 canvas.
DrawPath(builder.
TakePath(), {.color = Color::Red().WithAlpha(0.4)});
361 canvas.
Scale(GetContentScale());
365 std::vector<Color> colors = {
Color{1.0, 0.0, 0.0, 1.0},
366 Color{0.0, 0.0, 0.0, 1.0}};
367 std::vector<Scalar> stops = {0.0, 1.0};