2011-07-28 14:26:00 +00: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.
|
|
|
|
*/
|
2018-08-08 15:36:17 +00:00
|
|
|
#include "Sample.h"
|
2013-09-06 14:16:12 +00:00
|
|
|
#include "SkBlurMask.h"
|
2011-07-15 14:28:16 +00:00
|
|
|
#include "SkCanvas.h"
|
2018-03-14 17:01:17 +00:00
|
|
|
#include "SkMaskFilter.h"
|
2011-07-15 14:28:16 +00:00
|
|
|
|
2018-08-08 15:36:17 +00:00
|
|
|
class BigBlurView : public Sample {
|
2011-07-15 14:28:16 +00:00
|
|
|
public:
|
|
|
|
BigBlurView() {
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2018-08-08 15:36:17 +00:00
|
|
|
virtual bool onQuery(Sample::Event* evt) {
|
|
|
|
if (Sample::TitleQ(*evt)) {
|
|
|
|
Sample::TitleR(evt, "BigBlur");
|
2011-07-15 14:28:16 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return this->INHERITED::onQuery(evt);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void onDrawContent(SkCanvas* canvas) {
|
|
|
|
SkPaint paint;
|
|
|
|
canvas->save();
|
|
|
|
paint.setColor(SK_ColorBLUE);
|
2018-03-14 17:01:17 +00:00
|
|
|
paint.setMaskFilter(SkMaskFilter::MakeBlur(
|
2014-04-28 16:25:35 +00:00
|
|
|
kNormal_SkBlurStyle,
|
2018-03-14 17:01:17 +00:00
|
|
|
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(128))));
|
2011-07-15 14:28:16 +00:00
|
|
|
canvas->translate(200, 200);
|
2011-07-18 21:48:35 +00:00
|
|
|
canvas->drawCircle(100, 100, 200, paint);
|
2011-07-15 14:28:16 +00:00
|
|
|
canvas->restore();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2018-08-08 15:36:17 +00:00
|
|
|
typedef Sample INHERITED;
|
2011-07-15 14:28:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2018-08-08 15:36:17 +00:00
|
|
|
DEF_SAMPLE( return new BigBlurView(); )
|