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 "SampleCode.h" 8 #include "SkBlurMask.h" 9 #include "SkBlurMaskFilter.h" 10 #include "SkCanvas.h" 11 #include "SkView.h" 12 13 class BigBlurView : public SampleView { 14 public: BigBlurView()15 BigBlurView() { 16 } 17 18 protected: 19 // overrides from SkEventSink onQuery(SkEvent * evt)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 onDrawContent(SkCanvas * canvas)28 virtual void onDrawContent(SkCanvas* canvas) { 29 SkPaint paint; 30 canvas->save(); 31 paint.setColor(SK_ColorBLUE); 32 paint.setMaskFilter(SkBlurMaskFilter::Make( 33 kNormal_SkBlurStyle, 34 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(128)), 35 SkBlurMaskFilter::kHighQuality_BlurFlag)); 36 canvas->translate(200, 200); 37 canvas->drawCircle(100, 100, 200, paint); 38 canvas->restore(); 39 } 40 41 private: 42 typedef SkView INHERITED; 43 }; 44 45 ////////////////////////////////////////////////////////////////////////////// 46 MyFactory()47static SkView* MyFactory() { return new BigBlurView; } 48 static SkViewRegister reg(MyFactory); 49