Debian Codegraph @

docs/examples/Canvas_clipPath_2.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_2, 256, 256, false, 0) {
5 void draw(SkCanvas* canvas) {
6 SkPaint paint;
7 paint.setAntiAlias(true);
8 SkPath path = SkPathBuilder(SkPathFillType::kWinding)
9 .addRect({20, 15, 100, 95})
10 .addRect({50, 65, 130, 135})
11 .detach();
12 canvas->save();
13 canvas->clipPath(path, SkClipOp::kIntersect);
14 canvas->drawCircle(70, 85, 60, paint);
15 canvas->restore();
16 canvas->translate(100, 100);
17 path.setFillType(SkPathFillType::kEvenOdd);
18 canvas->clipPath(path, SkClipOp::kIntersect);
19 canvas->drawCircle(70, 85, 60, paint);
20 }
21 } // END FIDDLE