1 // Copyright 2020 Google LLC. 2 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. 3 #include "tools/fiddle/examples.h" 4 REG_FIDDLE(skpaint_corner_path_effects, 256, 256, false, 0) { star()5SkPath star() { 6 const SkScalar R = 115.2f, C = 128.0f; 7 SkPath path; 8 path.moveTo(C + R, C); 9 for (int i = 1; i < 7; ++i) { 10 SkScalar a = 2.6927937f * i; 11 path.lineTo(C + R * cos(a), C + R * sin(a)); 12 } 13 path.close(); 14 return path; 15 } draw(SkCanvas * canvas)16void draw(SkCanvas* canvas) { 17 SkPaint paint; 18 paint.setPathEffect(SkCornerPathEffect::Make(32.0f)); 19 paint.setStyle(SkPaint::kStroke_Style); 20 paint.setAntiAlias(true); 21 canvas->clear(SK_ColorWHITE); 22 SkPath path(star()); 23 canvas->drawPath(path, paint); 24 } 25 } // END FIDDLE 26