blob: cb7a419a80e647b086e73d7df192bd6de2ba1d9c [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 "SkBlurMaskFilter.h"
senorblanco@chromium.orge36ddf02011-07-15 14:28:16 +000010#include "SkCanvas.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);
reedefdfd512016-04-04 10:02:58 -070032 paint.setMaskFilter(SkBlurMaskFilter::Make(
commit-bot@chromium.orge3964552014-04-28 16:25:35 +000033 kNormal_SkBlurStyle,
robertphillips@google.comb7061172013-09-06 14:16:12 +000034 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(128)),
reedefdfd512016-04-04 10:02:58 -070035 SkBlurMaskFilter::kHighQuality_BlurFlag));
senorblanco@chromium.orge36ddf02011-07-15 14:28:16 +000036 canvas->translate(200, 200);
senorblanco@chromium.org4a947d22011-07-18 21:48:35 +000037 canvas->drawCircle(100, 100, 200, paint);
senorblanco@chromium.orge36ddf02011-07-15 14:28:16 +000038 canvas->restore();
39 }
40
41private:
42 typedef SkView INHERITED;
43};
44
45//////////////////////////////////////////////////////////////////////////////
46
47static SkView* MyFactory() { return new BigBlurView; }
48static SkViewRegister reg(MyFactory);