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=5acc77eba0cb4d00bbf3a8f4db0c0aee 6 REG_FIDDLE(Arc, 256, 128, false, 0) { 7 void draw(SkCanvas* canvas) { 8 SkRect oval = {8, 8, 56, 56}; 9 SkPaint ovalPaint; 10 ovalPaint.setAntiAlias(true); 11 SkPaint textPaint(ovalPaint); 12 ovalPaint.setStyle(SkPaint::kStroke_Style); 13 SkPaint arcPaint(ovalPaint); 14 arcPaint.setStrokeWidth(5); 15 arcPaint.setColor(SK_ColorBLUE); 16 canvas->translate(-64, 0); 17 for (char arcStyle = '1'; arcStyle <= '6'; ++arcStyle) { 18 '4' == arcStyle ? canvas->translate(-96, 55) : canvas->translate(64, 0); 19 canvas->drawText(&arcStyle, 1, 30, 36, textPaint); 20 canvas->drawOval(oval, ovalPaint); 21 SkPath path; 22 path.moveTo({56, 32}); 23 switch (arcStyle) { 24 case '1': 25 path.arcTo(oval, 0, 90, false); 26 break; 27 case '2': 28 canvas->drawArc(oval, 0, 90, false, arcPaint); 29 continue; 30 case '3': 31 path.addArc(oval, 0, 90); 32 break; 33 case '4': 34 path.arcTo({56, 56}, {32, 56}, 24); 35 break; 36 case '5': 37 path.arcTo({24, 24}, 0, SkPath::kSmall_ArcSize, SkPathDirection::kCW, {32, 56}); 38 break; 39 case '6': 40 path.conicTo({56, 56}, {32, 56}, SK_ScalarRoot2Over2); 41 break; 42 } 43 canvas->drawPath(path, arcPaint); 44 } 45 } 46 } // END FIDDLE 47 #endif // Disabled until updated to use current API. 48