blob: 4c1b83ced1086b9de90451b998983949e13a72fb [file] [log] [blame]
Hal Canary87515122019-03-15 14:22:51 -04001#if 0 // Disabled until updated to use current API.
2// Copyright 2019 Google LLC.
3// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Mike Kleinc0bd9f92019-04-23 12:05:21 -05004#include "tools/fiddle/examples.h"
Hal Canary87515122019-03-15 14:22:51 -04005// HASH=d2c33dc791cd165dcc2423226ba5b095
Hal Canarya7181e7c2019-03-18 16:06:34 -04006REG_FIDDLE(Path_FillType_b, 256, 230, false, 0) {
Hal Canary87515122019-03-15 14:22:51 -04007void draw(SkCanvas* canvas) {
8 SkPath path;
Mike Reed30bc5272019-11-22 18:34:02 +00009 path.addRect({20, 10, 80, 70}, SkPathDirection::kCW);
10 path.addRect({40, 30, 100, 90}, SkPathDirection::kCW);
Hal Canary87515122019-03-15 14:22:51 -040011 SkPaint strokePaint;
12 strokePaint.setStyle(SkPaint::kStroke_Style);
13 SkRect clipRect = {0, 0, 128, 128};
14 canvas->drawPath(path, strokePaint);
15 canvas->drawLine({0, 50}, {120, 50}, strokePaint);
16 SkPaint textPaint;
17 textPaint.setAntiAlias(true);
18 SkScalar textHPos[] = { 10, 30, 60, 90, 110 };
19 canvas->drawPosTextH("01210", 5, textHPos, 48, textPaint);
20 textPaint.setTextSize(18);
21 canvas->translate(0, 128);
22 canvas->scale(.5f, .5f);
23 canvas->drawString("inverse", 384, 150, textPaint);
24 SkPaint fillPaint;
Mike Reed7d34dc72019-11-26 12:17:17 -050025 for (auto fillType : { SkPathFillType::kWinding, SkPathFillType::kEvenOdd,
26 SkPathFillType::kInverseWinding, SkPathFillType::kInverseEvenOdd } ) {
Hal Canary87515122019-03-15 14:22:51 -040027 canvas->save();
28 canvas->clipRect(clipRect);
29 path.setFillType(fillType);
30 canvas->drawPath(path, fillPaint);
31 canvas->restore();
32 canvas->drawString(fillType & 1 ? "even-odd" : "winding", 64, 170, textPaint);
33 canvas->translate(128, 0);
34 }
35}
36} // END FIDDLE
37#endif // Disabled until updated to use current API.