• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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  */
7 #include "Sample.h"
8 #include "SkBlurMask.h"
9 #include "SkCanvas.h"
10 #include "SkMaskFilter.h"
11 
12 class BigBlurView : public Sample {
13 public:
BigBlurView()14     BigBlurView() {
15     }
16 
17 protected:
onQuery(Sample::Event * evt)18     virtual bool onQuery(Sample::Event* evt) {
19         if (Sample::TitleQ(*evt)) {
20             Sample::TitleR(evt, "BigBlur");
21             return true;
22         }
23         return this->INHERITED::onQuery(evt);
24     }
25 
onDrawContent(SkCanvas * canvas)26     virtual void onDrawContent(SkCanvas* canvas) {
27         SkPaint paint;
28         canvas->save();
29         paint.setColor(SK_ColorBLUE);
30         paint.setMaskFilter(SkMaskFilter::MakeBlur(
31             kNormal_SkBlurStyle,
32             SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(128))));
33         canvas->translate(200, 200);
34         canvas->drawCircle(100, 100, 200, paint);
35         canvas->restore();
36     }
37 
38 private:
39     typedef Sample INHERITED;
40 };
41 
42 //////////////////////////////////////////////////////////////////////////////
43 
44 DEF_SAMPLE( return new BigBlurView(); )
45