2011-07-28 18:26:00 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2011 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
2011-07-15 18:28:16 +04:00
|
|
|
#include "SampleCode.h"
|
2013-09-06 18:16:12 +04:00
|
|
|
#include "SkBlurMask.h"
|
2011-07-15 18:28:16 +04:00
|
|
|
#include "SkBlurMaskFilter.h"
|
|
|
|
#include "SkCanvas.h"
|
2013-09-06 18:16:12 +04:00
|
|
|
#include "SkView.h"
|
2011-07-15 18:28:16 +04:00
|
|
|
|
|
|
|
class BigBlurView : public SampleView {
|
|
|
|
public:
|
|
|
|
BigBlurView() {
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// overrides from SkEventSink
|
|
|
|
virtual bool onQuery(SkEvent* evt) {
|
|
|
|
if (SampleCode::TitleQ(*evt)) {
|
|
|
|
SampleCode::TitleR(evt, "BigBlur");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return this->INHERITED::onQuery(evt);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void onDrawContent(SkCanvas* canvas) {
|
|
|
|
SkPaint paint;
|
|
|
|
canvas->save();
|
|
|
|
paint.setColor(SK_ColorBLUE);
|
|
|
|
SkMaskFilter* mf = SkBlurMaskFilter::Create(
|
|
|
|
SkBlurMaskFilter::kNormal_BlurStyle,
|
2013-09-06 18:16:12 +04:00
|
|
|
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(128)),
|
2011-07-15 18:28:16 +04:00
|
|
|
SkBlurMaskFilter::kHighQuality_BlurFlag);
|
|
|
|
paint.setMaskFilter(mf)->unref();
|
|
|
|
canvas->translate(200, 200);
|
2011-07-19 01:48:35 +04:00
|
|
|
canvas->drawCircle(100, 100, 200, paint);
|
2011-07-15 18:28:16 +04:00
|
|
|
canvas->restore();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
typedef SkView INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
static SkView* MyFactory() { return new BigBlurView; }
|
|
|
|
static SkViewRegister reg(MyFactory);
|