blob: 5b005df4e874011c818bd505bad67ea703a2d625 [file] [log] [blame]
Hal Canary6c8422c2020-01-10 15:22:09 -05001// Copyright 2020 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3#include "tools/fiddle/examples.h"
4REG_FIDDLE(flag_us_1960, 486, 256, false, 0) {
5void draw(SkCanvas* canvas) {
6 SkPaint paint;
7 canvas->clear(SkColorSetARGB(0xFF, 0xFF, 0xFF, 0xFF));
8 canvas->scale(256.0f / 3900, 256.0f / 3900);
9 paint.setColor(SkColorSetARGB(0xFF, 0xB2, 0x22, 0x34));
10 for (int s = 0; s < 13; s += 2) {
11 canvas->drawIRect({0, s * 300, 7410, (s + 1) * 300}, paint);
12 }
13 paint.setColor(SkColorSetARGB(0xFF, 0x3C, 0x3B, 0x6E));
14 canvas->drawIRect({0, 0, 2964, 2100}, paint);
15 paint.setColor(SkColorSetARGB(0xFF, 0xFF, 0xFF, 0xFF));
16 paint.setAntiAlias(true);
17 SkPath star;
18 SkParsePath::FromSVGString(
19 "M 0 -120 L 70.5342 97.0819 L -114.127 -37.082 L 114.127 -37.0821 L -70.5342 "
20 "97.0819 Z",
21 &star);
22 for (int x = 1; x < 12; ++x) {
23 for (int y = 1; y < 10; ++y) {
24 if ((x + y) % 2 == 0) {
25 SkAutoCanvasRestore autoCanvasRestore(canvas, true);
26 canvas->translate(x * 247, y * 210);
27 canvas->drawPath(star, paint);
28 }
29 }
30 }
31}
32} // END FIDDLE