• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 #include "tools/fiddle/examples.h"
5 // HASH=4bbae00b40ed2cfcd0007921ad693a7b
6 REG_FIDDLE(Path_Direction, 256, 100, false, 0) {
7 void draw(SkCanvas* canvas) {
8     const SkPoint arrow[] = { {40, -5}, {45, 0}, {40, 5} };
9     const SkRect rect = {10, 10, 90, 90};
10     SkPaint rectPaint;
11     rectPaint.setAntiAlias(true);
12     SkPaint textPaint(rectPaint);
13     rectPaint.setStyle(SkPaint::kStroke_Style);
14     SkPaint arrowPaint(rectPaint);
15     SkPath arrowPath;
16     arrowPath.addPoly(arrow, SK_ARRAY_COUNT(arrow), true);
17     arrowPaint.setPathEffect(SkPath1DPathEffect::Make(arrowPath, 320, 0,
18                              SkPath1DPathEffect::kRotate_Style));
19     for (auto direction : { SkPathDirection::kCW, SkPathDirection::kCCW } ) {
20         canvas->drawRect(rect, rectPaint);
21         for (unsigned start : { 0, 1, 2, 3 } ) {
22            SkPath path;
23            path.addRect(rect, direction, start);
24            canvas->drawPath(path, arrowPaint);
25        }
26        canvas->drawString(SkPathDirection::kCW == direction ? "CW" : "CCW",  rect.centerX(),
27             rect.centerY(), textPaint);
28        canvas->translate(120, 0);
29     }
30 }
31 }  // END FIDDLE
32 #endif  // Disabled until updated to use current API.
33