Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 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. |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 4 | #include "tools/fiddle/examples.h" |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 5 | // HASH=c0216b3f7ebd80b9589ae5728f08fc80 |
Hal Canary | a7181e7c | 2019-03-18 16:06:34 -0400 | [diff] [blame] | 6 | REG_FIDDLE(Path_contains, 256, 256, false, 0) { |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 7 | void draw(SkCanvas* canvas) { |
| 8 | SkPath path; |
| 9 | SkPaint paint; |
| 10 | paint.setTextSize(256); |
| 11 | paint.getTextPath("&", 1, 30, 220, &path); |
| 12 | for (int y = 2; y < 256; y += 9) { |
| 13 | for (int x = 2; x < 256; x += 9) { |
| 14 | int coverage = 0; |
| 15 | for (int iy = -4; iy <= 4; iy += 2) { |
| 16 | for (int ix = -4; ix <= 4; ix += 2) { |
| 17 | coverage += path.contains(x + ix, y + iy); |
| 18 | } |
| 19 | } |
| 20 | paint.setColor(SkColorSetARGB(0x5f, 0xff * coverage / 25, 0, 0xff * (25 - coverage) / 25)); |
| 21 | canvas->drawCircle(x, y, 8, paint); |
| 22 | } |
| 23 | } |
| 24 | } |
| 25 | } // END FIDDLE |
| 26 | #endif // Disabled until updated to use current API. |