blob: 03349833f92dd76eb66c63c50d25e818e8cdd18d [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 */
senorblanco@chromium.orge36ddf02011-07-15 14:28:16 +00007#include "SampleCode.h"
robertphillips@google.comb7061172013-09-06 14:16:12 +00008#include "SkBlurMask.h"
senorblanco@chromium.orge36ddf02011-07-15 14:28:16 +00009#include "SkCanvas.h"
Mike Reed1be1f8d2018-03-14 13:01:17 -040010#include "SkMaskFilter.h"
robertphillips@google.comb7061172013-09-06 14:16:12 +000011#include "SkView.h"
senorblanco@chromium.orge36ddf02011-07-15 14:28:16 +000012
13class BigBlurView : public SampleView {
14public:
15 BigBlurView() {
16 }
17
18protected:
19 // overrides from SkEventSink
20 virtual bool onQuery(SkEvent* evt) {
21 if (SampleCode::TitleQ(*evt)) {
22 SampleCode::TitleR(evt, "BigBlur");
23 return true;
24 }
25 return this->INHERITED::onQuery(evt);
26 }
27
28 virtual void onDrawContent(SkCanvas* canvas) {
29 SkPaint paint;
30 canvas->save();
31 paint.setColor(SK_ColorBLUE);
Mike Reed1be1f8d2018-03-14 13:01:17 -040032 paint.setMaskFilter(SkMaskFilter::MakeBlur(
commit-bot@chromium.orge3964552014-04-28 16:25:35 +000033 kNormal_SkBlurStyle,
Mike Reed1be1f8d2018-03-14 13:01:17 -040034 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(128))));
senorblanco@chromium.orge36ddf02011-07-15 14:28:16 +000035 canvas->translate(200, 200);
senorblanco@chromium.org4a947d22011-07-18 21:48:35 +000036 canvas->drawCircle(100, 100, 200, paint);
senorblanco@chromium.orge36ddf02011-07-15 14:28:16 +000037 canvas->restore();
38 }
39
40private:
41 typedef SkView INHERITED;
42};
43
44//////////////////////////////////////////////////////////////////////////////
45
46static SkView* MyFactory() { return new BigBlurView; }
47static SkViewRegister reg(MyFactory);