Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
16namespace impeller {
17
18class Path;
19class HostBuffer;
20struct 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).
25class SolidRRectBlurContents final : public Contents {
26 public:
28
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_
SkColor4f color
std::function< Color(Color)> ColorFilterProc
Definition contents.h:38
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition render_pass.h:33
Draws a fast solid color blur of an rounded rectangle. Only supports RRects with fully symmetrical ra...
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.
bool ApplyColorFilter(const ColorFilterProc &color_filter_proc) override
If possible, applies a color filter to this contents inputs on the CPU.
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
void SetRRect(std::optional< Rect > rect, Size corner_radii={})
CanvasPath Path
Definition dart_ui.cc:58
In filters that use Gaussian distributions, "sigma" is a size of one standard deviation in terms of t...
Definition sigma.h:32