blob: 8cf7c97abdf0dec06c967bee21e5376471ac9d8c [file] [log] [blame]
Hal Canary87515122019-03-15 14:22:51 -04001#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 Kleinc0bd9f92019-04-23 12:05:21 -05004#include "tools/fiddle/examples.h"
Hal Canary87515122019-03-15 14:22:51 -04005// HASH=c0216b3f7ebd80b9589ae5728f08fc80
Hal Canarya7181e7c2019-03-18 16:06:34 -04006REG_FIDDLE(Path_contains, 256, 256, false, 0) {
Hal Canary87515122019-03-15 14:22:51 -04007void 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.