Flutter Engine
The Flutter Engine
skcanvas_square.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(skcanvas_square, 256, 256, false, 0) {
5void draw(SkCanvas* canvas) {
6 canvas->save();
7 canvas->translate(SkIntToScalar(128), SkIntToScalar(128));
8 canvas->rotate(SkIntToScalar(45));
9 SkRect rect = SkRect::MakeXYWH(-90.5f, -90.5f, 181.0f, 181.0f);
11 paint.setColor(SK_ColorBLUE);
12 canvas->drawRect(rect, paint);
13 canvas->restore();
14}
15} // END FIDDLE
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
#define SkIntToScalar(x)
Definition: SkScalar.h:57
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void rotate(SkScalar degrees)
Definition: SkCanvas.cpp:1300
int save()
Definition: SkCanvas.cpp:447
const Paint & paint
Definition: color_source.cc:38
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
REG_FIDDLE(skcanvas_square, 256, 256, false, 0)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659