Hal Canary | 6c8422c | 2020-01-10 15:22:09 -0500 | [diff] [blame] | 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(fluttershadow, 256, 256, false, 0) { |
| 5 | void draw(SkCanvas* canvas) { |
| 6 | SkPaint p; |
| 7 | p.setAntiAlias(true); |
| 8 | SkPath path; |
| 9 | path.moveTo(50.0, 50.0); |
| 10 | |
| 11 | // Comment the next 4 lines, and the shadow will draw. |
| 12 | path.lineTo(60.0, 50.0); |
| 13 | path.lineTo(60.0, 60.0); |
| 14 | path.lineTo(70.0, 60.0); |
| 15 | path.lineTo(70.0, 50.0); |
| 16 | |
| 17 | path.lineTo(150.0, 50.0); |
| 18 | path.lineTo(150.0, 150.0); |
| 19 | path.lineTo(50.0, 150.0); |
| 20 | path.close(); |
| 21 | p.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 3)); |
| 22 | canvas->drawPath(path, p); |
| 23 | } |
| 24 | } // END FIDDLE |