| 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
12 #include "impeller/entity/contents/contents.h"
13 #include "impeller/entity/contents/filters/filter_contents.h"
14 #include "impeller/geometry/color.h"
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:
27 SolidRRectBlurContents();
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
58 SolidRRectBlurContents(const SolidRRectBlurContents&) = delete;
59
60 SolidRRectBlurContents& operator=(const SolidRRectBlurContents&) = delete;
61 };
62
63 } // namespace impeller
64
65 #endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_SOLID_RRECT_BLUR_CONTENTS_H_
impeller::ContentContext
Definition: content_context.h:371
impeller::Contents
Definition: contents.h:31
impeller::Entity
Definition: entity.h:20
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
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
impeller::SolidRRectBlurContents::GetColor
Color GetColor() const
Definition: solid_rrect_blur_contents.cc:47
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:110
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:191
impeller::SolidRRectBlurContents::Render
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: solid_rrect_blur_contents.cc:121
impeller::SolidRRectBlurContents::SetSigma
void SetSigma(Sigma sigma)
Definition: solid_rrect_blur_contents.cc:39
impeller::SolidRRectBlurContents::SolidRRectBlurContents
SolidRRectBlurContents()
impeller::SolidRRectBlurContents::~SolidRRectBlurContents
~SolidRRectBlurContents() override
impeller::SolidRRectBlurContents::SetColor
void SetColor(Color color)
Definition: solid_rrect_blur_contents.cc:43
impeller::SolidRRectBlurContents::SetRRect
void SetRRect(std::optional< Rect > rect, Size corner_radii={})
Definition: solid_rrect_blur_contents.cc:33
color.h
contents.h
filter_contents.h
impeller
Definition: allocation.cc:12
impeller::ColorFilterProc
std::function< Color(Color)> ColorFilterProc
Definition: color_filter.h:36
impeller::Color
Definition: color.h:123
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::TSize< Scalar >