Flutter Engine
The Flutter Engine
flag_us_1792.cpp
Go to the documentation of this file.
1// 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.
4REG_FIDDLE(flag_us_1792, 486, 256, false, 0) {
5void draw(SkCanvas* canvas) {
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("M 0 -150 L 88 121 L -143 -46 L 143 -46 L -88 121 Z", &star);
19 for (int i = 0; i < 13; ++i) {
21 matrix.preRotate((360.0 / 13) * i);
22 matrix.preTranslate(0, -785);
23 SkAutoCanvasRestore autoCanvasRestore(canvas, true);
24 canvas->concat(matrix);
25 canvas->drawPath(star, paint);
26 }
27}
28} // END FIDDLE
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
Definition: SkColor.h:49
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void drawIRect(const SkIRect &rect, const SkPaint &paint)
Definition: SkCanvas.h:1358
void clear(SkColor color)
Definition: SkCanvas.h:1199
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
void concat(const SkMatrix &matrix)
Definition: SkCanvas.cpp:1318
static SkMatrix Translate(SkScalar dx, SkScalar dy)
Definition: SkMatrix.h:91
static bool FromSVGString(const char str[], SkPath *)
Definition: SkPath.h:59
const Paint & paint
Definition: color_source.cc:38
struct MyStruct s
REG_FIDDLE(flag_us_1792, 486, 256, false, 0)
Definition: flag_us_1792.cpp:4
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258