1cb93a386Sopenharmony_ci#if 0 // Disabled until updated to use current API. 2cb93a386Sopenharmony_ci// Copyright 2019 Google LLC. 3cb93a386Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. 4cb93a386Sopenharmony_ci#include "tools/fiddle/examples.h" 5cb93a386Sopenharmony_ci// HASH=78f3c65fa900610bb52518989b547095 6cb93a386Sopenharmony_ciREG_FIDDLE(Path_arcTo_2_b, 256, 128, false, 0) { 7cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) { 8cb93a386Sopenharmony_ci SkPaint tangentPaint; 9cb93a386Sopenharmony_ci tangentPaint.setAntiAlias(true); 10cb93a386Sopenharmony_ci SkPaint textPaint(tangentPaint); 11cb93a386Sopenharmony_ci tangentPaint.setStyle(SkPaint::kStroke_Style); 12cb93a386Sopenharmony_ci tangentPaint.setColor(SK_ColorGRAY); 13cb93a386Sopenharmony_ci SkPaint arcPaint(tangentPaint); 14cb93a386Sopenharmony_ci arcPaint.setStrokeWidth(5); 15cb93a386Sopenharmony_ci arcPaint.setColor(SK_ColorBLUE); 16cb93a386Sopenharmony_ci SkPath path; 17cb93a386Sopenharmony_ci SkPoint pts[] = { {156, 20}, {200, 20}, {170, 50} }; 18cb93a386Sopenharmony_ci SkScalar radius = 50; 19cb93a386Sopenharmony_ci path.moveTo(pts[0]); 20cb93a386Sopenharmony_ci path.arcTo(pts[1], pts[2], radius); 21cb93a386Sopenharmony_ci canvas->drawLine(pts[0], pts[1], tangentPaint); 22cb93a386Sopenharmony_ci canvas->drawLine(pts[1], pts[2], tangentPaint); 23cb93a386Sopenharmony_ci SkPoint lastPt; 24cb93a386Sopenharmony_ci (void) path.getLastPt(&lastPt); 25cb93a386Sopenharmony_ci SkVector radial = pts[2] - pts[1]; 26cb93a386Sopenharmony_ci radial.setLength(radius); 27cb93a386Sopenharmony_ci SkPoint center = { lastPt.fX - radial.fY, lastPt.fY + radial.fX }; 28cb93a386Sopenharmony_ci canvas->drawLine(lastPt, center, tangentPaint); 29cb93a386Sopenharmony_ci radial = pts[1] - pts[0]; 30cb93a386Sopenharmony_ci radial.setLength(radius); 31cb93a386Sopenharmony_ci SkPoint arcStart = { center.fX + radial.fY, center.fY - radial.fX }; 32cb93a386Sopenharmony_ci canvas->drawLine(center, arcStart, tangentPaint); 33cb93a386Sopenharmony_ci canvas->drawPath(path, arcPaint); 34cb93a386Sopenharmony_ci canvas->drawString("(x0, y0)", pts[0].fX, pts[0].fY - 7, textPaint); 35cb93a386Sopenharmony_ci canvas->drawString("(x1, y1)", pts[1].fX + 5, pts[1].fY, textPaint); 36cb93a386Sopenharmony_ci canvas->drawString("(x2, y2)", pts[2].fX, pts[2].fY + 15, textPaint); 37cb93a386Sopenharmony_ci canvas->drawString("radius", center.fX + 15, center.fY + 25, textPaint); 38cb93a386Sopenharmony_ci canvas->drawString("radius", center.fX - 5, center.fY - 20, textPaint); 39cb93a386Sopenharmony_ci} 40cb93a386Sopenharmony_ci} // END FIDDLE 41cb93a386Sopenharmony_ci#endif // Disabled until updated to use current API. 42