Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Canvas_drawRect.cpp
Go to the documentation of this file.
1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4// HASH=871b0da9b4a23de11ae7a772ce14aed3
5REG_FIDDLE(Canvas_drawRect, 256, 256, false, 0) {
6void draw(SkCanvas* canvas) {
7 SkPoint rectPts[] = { {64, 48}, {192, 160} };
9 paint.setAntiAlias(true);
11 paint.setStrokeWidth(20);
12 paint.setStrokeJoin(SkPaint::kRound_Join);
13 SkMatrix rotator;
14 rotator.setRotate(30, 128, 128);
16 paint.setColor(color);
17 SkRect rect;
18 rect.set(rectPts[0], rectPts[1]);
19 canvas->drawRect(rect, paint);
20 rotator.mapPoints(rectPts, 2);
21 }
22}
23} // END FIDDLE
SkColor4f color
constexpr SkColor SK_ColorYELLOW
Definition SkColor.h:139
constexpr SkColor SK_ColorMAGENTA
Definition SkColor.h:147
constexpr SkColor SK_ColorBLUE
Definition SkColor.h:135
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void drawRect(const SkRect &rect, const SkPaint &paint)
void mapPoints(SkPoint dst[], const SkPoint src[], int count) const
Definition SkMatrix.cpp:770
SkMatrix & setRotate(SkScalar degrees, SkScalar px, SkScalar py)
Definition SkMatrix.cpp:452
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
@ kRound_Join
adds circle
Definition SkPaint.h:360
const Paint & paint
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60