Debian Codegraph @

docs/examples/Canvas_clipPath.cpp

raw
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.
3 #include "tools/fiddle/examples.h"
4 REG_FIDDLE(Canvas_clipPath, 256, 256, false, 0) {
5 void draw(SkCanvas* canvas) {
6 SkPaint paint;
7 paint.setAntiAlias(true);
8 SkPath path = SkPath::Rect({20, 30, 100, 110});
9 path.setFillType(SkPathFillType::kInverseWinding);
10 canvas->save();
11 canvas->clipPath(path, SkClipOp::kDifference, false);
12 canvas->drawCircle(70, 100, 60, paint);
13 canvas->restore();
14 canvas->translate(100, 100);
15 path.setFillType(SkPathFillType::kWinding);
16 canvas->clipPath(path, SkClipOp::kIntersect, false);
17 canvas->drawCircle(70, 100, 60, paint);
18 }
19 } // END FIDDLE