Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
AnimatedTiledImageBlur Class Reference
Inheritance diagram for AnimatedTiledImageBlur:
skiagm::GM

Public Member Functions

 AnimatedTiledImageBlur ()
 
- Public Member Functions inherited from skiagm::GM
 GM (SkColor backgroundColor=SK_ColorWHITE)
 
virtual ~GM ()
 
void setMode (Mode mode)
 
Mode getMode () const
 
DrawResult gpuSetup (SkCanvas *, SkString *errorMsg, GraphiteTestContext *=nullptr)
 
void gpuTeardown ()
 
void onceBeforeDraw ()
 
DrawResult draw (SkCanvas *canvas)
 
DrawResult draw (SkCanvas *, SkString *errorMsg)
 
void drawBackground (SkCanvas *)
 
DrawResult drawContent (SkCanvas *canvas)
 
DrawResult drawContent (SkCanvas *, SkString *errorMsg)
 
virtual SkISize getISize ()=0
 
virtual SkString getName () const =0
 
virtual bool runAsBench () const
 
SkScalar width ()
 
SkScalar height ()
 
SkColor getBGColor () const
 
void setBGColor (SkColor)
 
void drawSizeBounds (SkCanvas *, SkColor)
 
bool animate (double)
 
virtual bool onChar (SkUnichar)
 
bool getControls (SkMetaData *controls)
 
void setControls (const SkMetaData &controls)
 
virtual void modifyGrContextOptions (GrContextOptions *)
 
virtual void modifyGraphiteContextOptions (skgpu::graphite::ContextOptions *) const
 
virtual bool isBazelOnly () const
 
virtual std::map< std::string, std::string > getGoldKeys () const
 

Protected Member Functions

bool runAsBench () const override
 
SkString getName () const override
 
SkISize getISize () override
 
void onOnceBeforeDraw () override
 
void onDraw (SkCanvas *canvas) override
 
bool onAnimate (double nanos) override
 
- Protected Member Functions inherited from skiagm::GM
virtual DrawResult onGpuSetup (SkCanvas *, SkString *, GraphiteTestContext *)
 
virtual void onGpuTeardown ()
 
virtual void onOnceBeforeDraw ()
 
virtual DrawResult onDraw (SkCanvas *, SkString *errorMsg)
 
virtual void onDraw (SkCanvas *)
 
virtual bool onAnimate (double)
 
virtual bool onGetControls (SkMetaData *)
 
virtual void onSetControls (const SkMetaData &)
 
GraphiteTestContextgraphiteTestContext () const
 

Additional Inherited Members

- Public Types inherited from skiagm::GM
enum  Mode { kGM_Mode , kSample_Mode , kBench_Mode }
 
using DrawResult = skiagm::DrawResult
 
using GraphiteTestContext = skiatest::graphite::GraphiteTestContext
 
- Static Public Attributes inherited from skiagm::GM
static constexpr char kErrorMsg_DrawSkippedGpuOnly []
 

Detailed Description

Definition at line 147 of file animatedimageblurs.cpp.

Constructor & Destructor Documentation

◆ AnimatedTiledImageBlur()

AnimatedTiledImageBlur::AnimatedTiledImageBlur ( )
inline

Definition at line 151 of file animatedimageblurs.cpp.

151 : fBlurSigma(0.3f * kMaxBlurSigma) {
152 this->setBGColor(0xFFCCCCCC);
153 }
void setBGColor(SkColor)
Definition: gm.cpp:159

Member Function Documentation

◆ getISize()

SkISize AnimatedTiledImageBlur::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 160 of file animatedimageblurs.cpp.

160{ return SkISize::Make(530, 530); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString AnimatedTiledImageBlur::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 158 of file animatedimageblurs.cpp.

158{ return SkString("animated-tiled-image-blur"); }

◆ onAnimate()

bool AnimatedTiledImageBlur::onAnimate ( double  nanos)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 184 of file animatedimageblurs.cpp.

184 {
185 fBlurSigma = TimeUtils::PingPong(1e-9 * nanos, kAnimationDuration,
186 0.f, 0.0f, kMaxBlurSigma);
187 return true;
188 }
static float PingPong(double time, float period, float phase, float ends, float mid)
Definition: TimeUtils.h:37

◆ onDraw()

void AnimatedTiledImageBlur::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 166 of file animatedimageblurs.cpp.

166 {
167 auto drawBlurredImage = [&](float tx, float ty, SkTileMode tileMode) {
169 SkRect rect = SkRect::MakeIWH(250, 250);
170 canvas->save();
171 canvas->translate(tx, ty);
172 paint.setImageFilter(SkImageFilters::Blur(fBlurSigma, fBlurSigma, tileMode,
173 nullptr, rect));
174 canvas->drawImageRect(fImage, rect, SkFilterMode::kLinear, &paint);
175 canvas->restore();
176 };
177
178 drawBlurredImage(10.f, 10.f, SkTileMode::kDecal);
179 drawBlurredImage(270.f, 10.f, SkTileMode::kClamp);
180 drawBlurredImage(10.f, 270.f, SkTileMode::kRepeat);
181 drawBlurredImage(270.f, 270.f, SkTileMode::kMirror);
182 }
SkTileMode
Definition: SkTileMode.h:13
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
Definition: SkCanvas.cpp:2333
int save()
Definition: SkCanvas.cpp:447
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
const Paint & paint
Definition: color_source.cc:38
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
static SkRect MakeIWH(int w, int h)
Definition: SkRect.h:623

◆ onOnceBeforeDraw()

void AnimatedTiledImageBlur::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 162 of file animatedimageblurs.cpp.

162 {
163 fImage = ToolUtils::GetResourceAsImage("images/mandrill_512.png");
164 }
sk_sp< SkImage > GetResourceAsImage(const char *resource)
Definition: DecodeUtils.h:25

◆ runAsBench()

bool AnimatedTiledImageBlur::runAsBench ( ) const
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 156 of file animatedimageblurs.cpp.

156{ return true; }

The documentation for this class was generated from the following file: