blob: b7d60df0402e3b319306003297b0ea2b427f40b7 [file] [log] [blame]
Hal Canary6c8422c2020-01-10 15:22:09 -05001// 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"
4REG_FIDDLE(no_gpu_blur, 256, 256, false, 0) {
5void draw(SkCanvas* canvas) {
6 SkBitmap alpha, bitmap;
7 bitmap.allocN32Pixels(100, 100);
8 SkCanvas offscreen(bitmap);
9 offscreen.clear(0);
10 SkPaint paint;
11 paint.setAntiAlias(true);
12 paint.setColor(SK_ColorBLUE);
13 paint.setStyle(SkPaint::kStroke_Style);
14 paint.setStrokeWidth(20);
15 offscreen.drawCircle(50, 50, 39, paint);
16 offscreen.flush();
17 paint.setMaskFilter(SkMaskFilter::MakeBlur(kOuter_SkBlurStyle, 3));
18 SkIPoint offset;
19 bitmap.extractAlpha(&alpha, &paint, nullptr, &offset);
20 paint.setColor(SK_ColorRED);
21 canvas->drawBitmap(bitmap, 0, -offset.fY, &paint);
22 canvas->drawBitmap(alpha, 100 + offset.fX, 0, &paint);
23}
24} // END FIDDLE