blob: d711fabccf8d24d8ec49f00a7e6240035eb603c6 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001/*
2 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
Mike Kleinc0bd9f92019-04-23 12:05:21 -05007#include "include/core/SkCanvas.h"
8#include "include/core/SkMaskFilter.h"
9#include "samplecode/Sample.h"
10#include "src/core/SkBlurMask.h"
senorblanco@chromium.orge36ddf02011-07-15 14:28:16 +000011
Ben Wagnerb2c4ea62018-08-08 11:36:17 -040012class BigBlurView : public Sample {
senorblanco@chromium.orge36ddf02011-07-15 14:28:16 +000013public:
14 BigBlurView() {
15 }
16
17protected:
Ben Wagnerb2c4ea62018-08-08 11:36:17 -040018 virtual bool onQuery(Sample::Event* evt) {
19 if (Sample::TitleQ(*evt)) {
20 Sample::TitleR(evt, "BigBlur");
senorblanco@chromium.orge36ddf02011-07-15 14:28:16 +000021 return true;
22 }
23 return this->INHERITED::onQuery(evt);
24 }
25
26 virtual void onDrawContent(SkCanvas* canvas) {
27 SkPaint paint;
28 canvas->save();
29 paint.setColor(SK_ColorBLUE);
Mike Reed1be1f8d2018-03-14 13:01:17 -040030 paint.setMaskFilter(SkMaskFilter::MakeBlur(
commit-bot@chromium.orge3964552014-04-28 16:25:35 +000031 kNormal_SkBlurStyle,
Mike Reed1be1f8d2018-03-14 13:01:17 -040032 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(128))));
senorblanco@chromium.orge36ddf02011-07-15 14:28:16 +000033 canvas->translate(200, 200);
senorblanco@chromium.org4a947d22011-07-18 21:48:35 +000034 canvas->drawCircle(100, 100, 200, paint);
senorblanco@chromium.orge36ddf02011-07-15 14:28:16 +000035 canvas->restore();
36 }
37
38private:
Ben Wagnerb2c4ea62018-08-08 11:36:17 -040039 typedef Sample INHERITED;
senorblanco@chromium.orge36ddf02011-07-15 14:28:16 +000040};
41
42//////////////////////////////////////////////////////////////////////////////
43
Ben Wagnerb2c4ea62018-08-08 11:36:17 -040044DEF_SAMPLE( return new BigBlurView(); )