Flutter Engine
The Flutter Engine
Canvas_clipRect.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.
4REG_FIDDLE(Canvas_clipRect, 256, 128, false, 0) {
5void draw(SkCanvas* canvas) {
6 canvas->rotate(10);
8 paint.setAntiAlias(true);
9 for (auto alias: { false, true } ) {
10 canvas->save();
11 canvas->clipRect(SkRect::MakeWH(90, 80), SkClipOp::kIntersect, alias);
12 canvas->drawCircle(100, 60, 60, paint);
13 canvas->restore();
14 canvas->translate(80, 0);
15 }
16}
17} // END FIDDLE
REG_FIDDLE(Canvas_clipRect, 256, 128, false, 0)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
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
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
Definition: SkCanvas.cpp:2707
const Paint & paint
Definition: color_source.cc:38
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609