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=c98773d8b4509969d78cb8121e4b77f6 6cb93a386Sopenharmony_ciREG_FIDDLE(Point_Length, 256, 192, false, 0) { 7cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) { 8cb93a386Sopenharmony_ci SkPaint paint; 9cb93a386Sopenharmony_ci paint.setAntiAlias(true); 10cb93a386Sopenharmony_ci const SkPoint points[] = { { 90, 30 }, { 120, 150 }, { 150, 30 }, { 210, 90 } }; 11cb93a386Sopenharmony_ci const SkPoint origin = {30, 140}; 12cb93a386Sopenharmony_ci for (auto point : points) { 13cb93a386Sopenharmony_ci canvas->drawLine(origin, point, paint); 14cb93a386Sopenharmony_ci SkAutoCanvasRestore acr(canvas, true); 15cb93a386Sopenharmony_ci SkScalar angle = SkScalarATan2((point.fY - origin.fY), point.fX - origin.fX); 16cb93a386Sopenharmony_ci canvas->rotate(angle * 180 / SK_ScalarPI, origin.fX, origin.fY); 17cb93a386Sopenharmony_ci SkString length("length = "); 18cb93a386Sopenharmony_ci length.appendScalar(SkPoint::Length(point.fX, point.fY)); 19cb93a386Sopenharmony_ci canvas->drawString(length, origin.fX + 25, origin.fY - 4, paint); 20cb93a386Sopenharmony_ci } 21cb93a386Sopenharmony_ci} 22cb93a386Sopenharmony_ci} // END FIDDLE 23cb93a386Sopenharmony_ci#endif // Disabled until updated to use current API. 24