| 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 #pragma once
6
7 #include <functional>
8 #include <memory>
9 #include <vector>
10
11 #include "impeller/entity/contents/contents.h"
12 #include "impeller/entity/contents/filters/filter_contents.h"
13 #include "impeller/geometry/color.h"
14
15 namespace impeller {
16
17 class Path;
18 class HostBuffer;
19 struct VertexBuffer;
20
21 /// @brief Draws a fast solid color blur of an rounded rectangle. Only supports
22 /// RRects with fully symmetrical radii. Also produces correct results for
23 /// rectangles (corner_radius=0) and circles (corner_radius=width/2=height/2).
24 class SolidRRectBlurContents final : public Contents {
25 public:
26 SolidRRectBlurContents();
27
28 ~SolidRRectBlurContents() override;
29
30 void SetRRect(std::optional<Rect> rect, Scalar corner_radius = 0);
31
32 void SetSigma(Sigma sigma);
33
34 void SetColor(Color color);
35
36 Color GetColor() const;
37
38 // |Contents|
39 std::optional<Rect> GetCoverage(const Entity& entity) const override;
40
41 // |Contents|
42 bool Render(const ContentContext& renderer,
43 const Entity& entity,
44 RenderPass& pass) const override;
45
46 // |Contents|
47 [[nodiscard]] bool ApplyColorFilter(
48 const ColorFilterProc& color_filter_proc) override;
49
50 private:
51 std::optional<Rect> rect_;
52 Scalar corner_radius_;
53 Sigma sigma_;
54
55 Color color_;
56
57 FML_DISALLOW_COPY_AND_ASSIGN(SolidRRectBlurContents);
58 };
59
60 } // namespace impeller
contents.h
impeller::Scalar
float Scalar
Definition: scalar.h:15
impeller::Color
Definition: color.h:122
impeller::SolidRRectBlurContents::GetColor
Color GetColor() const
Definition: solid_rrect_blur_contents.cc:38
impeller::SolidRRectBlurContents::SetSigma
void SetSigma(Sigma sigma)
Definition: solid_rrect_blur_contents.cc:30
impeller::SolidRRectBlurContents::SetColor
void SetColor(Color color)
Definition: solid_rrect_blur_contents.cc:34
impeller::SolidRRectBlurContents::SolidRRectBlurContents
SolidRRectBlurContents()
impeller::Entity
Definition: entity.h:21
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:24
filter_contents.h
impeller::Contents::ColorFilterProc
std::function< Color(Color)> ColorFilterProc
Definition: contents.h:37
impeller::Sigma
In filters that use Gaussian distributions, "sigma" is a size of one standard deviation in terms of t...
Definition: sigma.h:31
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:127
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:27
impeller::SolidRRectBlurContents::Render
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: solid_rrect_blur_contents.cc:56
color.h
impeller::SolidRRectBlurContents::GetCoverage
std::optional< Rect > GetCoverage(const Entity &entity) const override
Get the screen space bounding rectangle that this contents affects.
Definition: solid_rrect_blur_contents.cc:42
impeller::SolidRRectBlurContents::SetRRect
void SetRRect(std::optional< Rect > rect, Scalar corner_radius=0)
Definition: solid_rrect_blur_contents.cc:24
impeller::Contents
Definition: contents.h:33
impeller
Definition: aiks_context.cc:10
impeller::ContentContext
Definition: content_context.h:344
impeller::SolidRRectBlurContents::~SolidRRectBlurContents
~SolidRRectBlurContents() override