blob: f5e632c34562ce4f1bd8d76f98e36ff3f801b21f [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
2/*
3 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
senorblanco@chromium.orge36ddf02011-07-15 14:28:16 +00008#include "SampleCode.h"
9#include "SkBlurMaskFilter.h"
10#include "SkView.h"
11#include "SkCanvas.h"
12
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);
32 SkMaskFilter* mf = SkBlurMaskFilter::Create(
33 128,
34 SkBlurMaskFilter::kNormal_BlurStyle,
35 SkBlurMaskFilter::kHighQuality_BlurFlag);
36 paint.setMaskFilter(mf)->unref();
37 canvas->translate(200, 200);
senorblanco@chromium.org4a947d22011-07-18 21:48:35 +000038 canvas->drawCircle(100, 100, 200, paint);
senorblanco@chromium.orge36ddf02011-07-15 14:28:16 +000039 canvas->restore();
40 }
41
42private:
43 typedef SkView INHERITED;
44};
45
46//////////////////////////////////////////////////////////////////////////////
47
48static SkView* MyFactory() { return new BigBlurView; }
49static SkViewRegister reg(MyFactory);
50