Flutter Impeller
solid_rrect_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_BLUR_CONTENTS_H_
6 #define FLUTTER_IMPELLER_ENTITY_CONTENTS_SOLID_RRECT_BLUR_CONTENTS_H_
7 
8 #include <functional>
9 #include <memory>
10 #include <vector>
11 
15 
16 namespace impeller {
17 
18 class Path;
19 class HostBuffer;
20 struct VertexBuffer;
21 
22 /// @brief Draws a fast solid color blur of an rounded rectangle. Only supports
23 /// RRects with fully symmetrical radii. Also produces correct results for
24 /// rectangles (corner_radius=0) and circles (corner_radius=width/2=height/2).
25 class SolidRRectBlurContents final : public Contents {
26  public:
28 
29  ~SolidRRectBlurContents() override;
30 
31  void SetRRect(std::optional<Rect> rect, Size corner_radii = {});
32 
33  void SetSigma(Sigma sigma);
34 
35  void SetColor(Color color);
36 
37  Color GetColor() const;
38 
39  // |Contents|
40  std::optional<Rect> GetCoverage(const Entity& entity) const override;
41 
42  // |Contents|
43  bool Render(const ContentContext& renderer,
44  const Entity& entity,
45  RenderPass& pass) const override;
46 
47  // |Contents|
48  [[nodiscard]] bool ApplyColorFilter(
49  const ColorFilterProc& color_filter_proc) override;
50 
51  private:
52  std::optional<Rect> rect_;
53  Size corner_radii_;
54  Sigma sigma_;
55 
56  Color color_;
57 
59 
60  SolidRRectBlurContents& operator=(const SolidRRectBlurContents&) = delete;
61 };
62 
63 } // namespace impeller
64 
65 #endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_SOLID_RRECT_BLUR_CONTENTS_H_
contents.h
impeller::Color
Definition: color.h:124
impeller::SolidRRectBlurContents::GetColor
Color GetColor() const
Definition: solid_rrect_blur_contents.cc:43
impeller::SolidRRectBlurContents::SetSigma
void SetSigma(Sigma sigma)
Definition: solid_rrect_blur_contents.cc:35
impeller::SolidRRectBlurContents::SetColor
void SetColor(Color color)
Definition: solid_rrect_blur_contents.cc:39
impeller::SolidRRectBlurContents::SolidRRectBlurContents
SolidRRectBlurContents()
impeller::Entity
Definition: entity.h:21
impeller::TSize< Scalar >
impeller::SolidRRectBlurContents
Draws a fast solid color blur of an rounded rectangle. Only supports RRects with fully symmetrical ra...
Definition: solid_rrect_blur_contents.h:25
filter_contents.h
impeller::Contents::ColorFilterProc
std::function< Color(Color)> ColorFilterProc
Definition: contents.h:38
impeller::Sigma
In filters that use Gaussian distributions, "sigma" is a size of one standard deviation in terms of t...
Definition: sigma.h:32
impeller::SolidRRectBlurContents::ApplyColorFilter
bool ApplyColorFilter(const ColorFilterProc &color_filter_proc) override
If possible, applies a color filter to this contents inputs on the CPU.
Definition: solid_rrect_blur_contents.cc:132
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:33
impeller::SolidRRectBlurContents::Render
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: solid_rrect_blur_contents.cc:58
impeller::SolidRRectBlurContents::SetRRect
void SetRRect(std::optional< Rect > rect, Size corner_radii={})
Definition: solid_rrect_blur_contents.cc:29
color.h
impeller::SolidRRectBlurContents::GetCoverage
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.
Definition: solid_rrect_blur_contents.cc:47
impeller::Contents
Definition: contents.h:34
impeller
Definition: aiks_blur_unittests.cc:20
impeller::ContentContext
Definition: content_context.h:392
impeller::SolidRRectBlurContents::~SolidRRectBlurContents
~SolidRRectBlurContents() override