Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / docs / examples / backdrop_blur_with_rrect_clip.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(backdrop_blur_with_rrect_clip, 512, 512, false, 3) {
5 void draw(SkCanvas* canvas) {
6     const SkRect r = SkRect::MakeXYWH(128, 128, 256, 256);
7     const SkRRect rr = SkRRect::MakeRectXY(r, 128, 128);
8
9     canvas->drawImage(image, 0, 0);
10
11     canvas->save();
12     canvas->clipRRect(rr, true);
13
14     sk_sp<SkImageFilter> filter = SkImageFilters::Blur(10, 10, nullptr);
15     SkPaint p;
16     p.setImageFilter(std::move(filter));
17
18     SkCanvas::SaveLayerRec slr(&r, &p, SkCanvas::kInitWithPrevious_SaveLayerFlag);
19     canvas->saveLayer(slr);
20     canvas->drawColor(0x40FFFFFF);
21     canvas->restore();
22     canvas->restore();
23 }
24 }  // END FIDDLE