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=f1122d6fffddac0167e96fab4b9a862f |
Hal Canary | a7181e7c | 2019-03-18 16:06:34 -0400 | [diff] [blame] | 6 | REG_FIDDLE(Path_addOval_2, 256, 160, false, 0) { |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 7 | void draw(SkCanvas* canvas) { |
| 8 | const SkPoint arrow[] = { {0, -5}, {10, 0}, {0, 5} }; |
| 9 | const SkRect rect = {10, 10, 54, 54}; |
| 10 | SkPaint ovalPaint; |
| 11 | ovalPaint.setAntiAlias(true); |
| 12 | SkPaint textPaint(ovalPaint); |
| 13 | ovalPaint.setStyle(SkPaint::kStroke_Style); |
| 14 | SkPaint arrowPaint(ovalPaint); |
| 15 | SkPath arrowPath; |
| 16 | arrowPath.addPoly(arrow, SK_ARRAY_COUNT(arrow), true); |
| 17 | arrowPaint.setPathEffect(SkPath1DPathEffect::Make(arrowPath, 176, 0, |
| 18 | SkPath1DPathEffect::kRotate_Style)); |
Mike Reed | 30bc527 | 2019-11-22 18:34:02 +0000 | [diff] [blame] | 19 | for (auto direction : { SkPathDirection::kCW, SkPathDirection::kCCW } ) { |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 20 | for (unsigned start : { 0, 1, 2, 3 } ) { |
| 21 | SkPath path; |
| 22 | path.addOval(rect, direction, start); |
| 23 | canvas->drawPath(path, ovalPaint); |
| 24 | canvas->drawPath(path, arrowPaint); |
| 25 | canvas->drawText(&"0123"[start], 1, rect.centerX(), rect.centerY() + 5, textPaint); |
| 26 | canvas->translate(64, 0); |
| 27 | } |
| 28 | canvas->translate(-256, 72); |
Mike Reed | 30bc527 | 2019-11-22 18:34:02 +0000 | [diff] [blame] | 29 | canvas->drawString(SkPathDirection::kCW == direction ? "clockwise" : "counterclockwise", |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 30 | 128, 0, textPaint); |
| 31 | } |
| 32 | } |
| 33 | } // END FIDDLE |
| 34 | #endif // Disabled until updated to use current API. |