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=386000684073fccabc224d7d6dc81cd9 6 REG_FIDDLE(Path_arcTo_2_a, 256, 226, false, 0) { 7 void draw(SkCanvas* canvas) { 8 SkPaint tangentPaint; 9 tangentPaint.setAntiAlias(true); 10 SkPaint textPaint(tangentPaint); 11 tangentPaint.setStyle(SkPaint::kStroke_Style); 12 tangentPaint.setColor(SK_ColorGRAY); 13 SkPaint arcPaint(tangentPaint); 14 arcPaint.setStrokeWidth(5); 15 arcPaint.setColor(SK_ColorBLUE); 16 SkPath path; 17 SkPoint pts[] = { {56, 20}, {200, 20}, {90, 190} }; 18 SkScalar radius = 50; 19 path.moveTo(pts[0]); 20 path.arcTo(pts[1], pts[2], radius); 21 canvas->drawLine(pts[0], pts[1], tangentPaint); 22 canvas->drawLine(pts[1], pts[2], tangentPaint); 23 SkPoint lastPt; 24 (void) path.getLastPt(&lastPt); 25 SkVector radial = pts[2] - pts[1]; 26 radial.setLength(radius); 27 SkPoint center = { lastPt.fX - radial.fY, lastPt.fY + radial.fX }; 28 canvas->drawCircle(center, radius, tangentPaint); 29 canvas->drawLine(lastPt, center, tangentPaint); 30 radial = pts[1] - pts[0]; 31 radial.setLength(radius); 32 SkPoint arcStart = { center.fX + radial.fY, center.fY - radial.fX }; 33 canvas->drawLine(center, arcStart, tangentPaint); 34 canvas->drawPath(path, arcPaint); 35 canvas->drawString("(x0, y0)", pts[0].fX - 5, pts[0].fY, textPaint); 36 canvas->drawString("(x1, y1)", pts[1].fX + 5, pts[1].fY, textPaint); 37 canvas->drawString("(x2, y2)", pts[2].fX, pts[2].fY + 15, textPaint); 38 canvas->drawString("radius", center.fX + 15, center.fY + 25, textPaint); 39 canvas->drawString("radius", center.fX - 3, center.fY - 16, textPaint); 40 } 41 } // END FIDDLE 42 #endif // Disabled until updated to use current API. 43