Flutter Engine
 
Loading...
Searching...
No Matches
solid_rrect_like_blur_contents.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_IMPELLER_ENTITY_CONTENTS_SOLID_RRECT_LIKE_BLUR_CONTENTS_H_
6#define FLUTTER_IMPELLER_ENTITY_CONTENTS_SOLID_RRECT_LIKE_BLUR_CONTENTS_H_
7
8#include <functional>
9#include <memory>
10#include <vector>
11
15
16namespace impeller {
17
18/// @brief A base class for SolidRRectBlurContents and
19/// SolidRSuperellipseBlurContents.
21 public:
23
24 void SetShape(Rect rect, Scalar corner_radius);
25
26 void SetSigma(Sigma sigma);
27
28 void SetColor(Color color);
29
30 Color GetColor() const;
31
32 // |Contents|
33 std::optional<Rect> GetCoverage(const Entity& entity) const override;
34
35 // |Contents|
36 bool Render(const ContentContext& renderer,
37 const Entity& entity,
38 RenderPass& pass) const override;
39
40 // |Contents|
41 [[nodiscard]] bool ApplyColorFilter(
42 const ColorFilterProc& color_filter_proc) override;
43
44 protected:
58
60
61 virtual bool SetPassInfo(RenderPass& pass,
62 const ContentContext& renderer,
63 PassContext& pass_context) const = 0;
64
65 Rect GetRect() const { return rect_; }
66 Scalar GetCornerRadius() const { return corner_radius_; }
67 Sigma GetSigma() const { return sigma_; }
68
69 static Vector4 Concat(Vector2& a, Vector2& b);
70
71 private:
72 static bool PopulateFragContext(PassContext& pass_context,
73 Scalar blurSigma,
74 Point center,
75 Point rSize,
76 Scalar radius);
77
78 Rect rect_;
79 Scalar corner_radius_;
80 Sigma sigma_;
81 Color color_;
82
84
86 delete;
87};
88
89} // namespace impeller
90
91#endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_SOLID_RRECT_LIKE_BLUR_CONTENTS_H_
std::function< Color(Color)> ColorFilterProc
Definition contents.h:35
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition render_pass.h:30
A base class for SolidRRectBlurContents and SolidRSuperellipseBlurContents.
void SetShape(Rect rect, Scalar corner_radius)
std::optional< Rect > GetCoverage(const Entity &entity) const override
Get the area of the render pass that will be affected when this contents is rendered.
virtual bool SetPassInfo(RenderPass &pass, const ContentContext &renderer, PassContext &pass_context) const =0
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
bool ApplyColorFilter(const ColorFilterProc &color_filter_proc) override
If possible, applies a color filter to this contents inputs on the CPU.
static Vector4 Concat(Vector2 &a, Vector2 &b)
float Scalar
Definition scalar.h:19
In filters that use Gaussian distributions, "sigma" is a size of one standard deviation in terms of t...
Definition sigma.h:32