Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / docs / examples / no_gpu_blur.cpp
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(no_gpu_blur, 256, 256, false, 0) {
5 void 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->drawImage(bitmap.asImage(), 0, -offset.fY, SkSamplingOptions(), &paint);
22     canvas->drawImage(alpha.asImage(), 100 + offset.fX, 0, SkSamplingOptions(), &paint);
23 }
24 }  // END FIDDLE