Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 1 | #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 Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 4 | #include "tools/fiddle/examples.h" |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 5 | // HASH=d2c33dc791cd165dcc2423226ba5b095 |
Hal Canary | a7181e7c | 2019-03-18 16:06:34 -0400 | [diff] [blame] | 6 | REG_FIDDLE(Path_FillType_b, 256, 230, false, 0) { |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 7 | void draw(SkCanvas* canvas) { |
| 8 | SkPath path; |
Mike Reed | 30bc527 | 2019-11-22 18:34:02 +0000 | [diff] [blame] | 9 | path.addRect({20, 10, 80, 70}, SkPathDirection::kCW); |
| 10 | path.addRect({40, 30, 100, 90}, SkPathDirection::kCW); |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 11 | 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 Reed | 7d34dc7 | 2019-11-26 12:17:17 -0500 | [diff] [blame] | 25 | for (auto fillType : { SkPathFillType::kWinding, SkPathFillType::kEvenOdd, |
| 26 | SkPathFillType::kInverseWinding, SkPathFillType::kInverseEvenOdd } ) { |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 27 | 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. |