| Flutter Impeller |

conical_gradient_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_CONICAL_GRADIENT_CONTENTS_H_
6 #define FLUTTER_IMPELLER_ENTITY_CONTENTS_CONICAL_GRADIENT_CONTENTS_H_
7
8 #include <vector>
9
10 #include "impeller/entity/contents/color_source_contents.h"
11 #include "impeller/entity/entity.h"
12 #include "impeller/geometry/color.h"
13 #include "impeller/geometry/point.h"
14
15 namespace impeller {
16
17 class ConicalGradientContents final : public ColorSourceContents {
18 public:
19 ConicalGradientContents();
20
21 ~ConicalGradientContents() override;
22
23 // |Contents|
24 bool Render(const ContentContext& renderer,
25 const Entity& entity,
26 RenderPass& pass) const override;
27
28 // |Contents|
29 [[nodiscard]] bool ApplyColorFilter(
30 const ColorFilterProc& color_filter_proc) override;
31
32 void SetCenterAndRadius(Point center, Scalar radius);
33
34 void SetColors(std::vector<Color> colors);
35
36 void SetStops(std::vector<Scalar> stops);
37
38 const std::vector<Color>& GetColors() const;
39
40 const std::vector<Scalar>& GetStops() const;
41
42 void SetTileMode(Entity::TileMode tile_mode);
43
44 void SetFocus(std::optional<Point> focus, Scalar radius);
45
46 private:
47 bool RenderTexture(const ContentContext& renderer,
48 const Entity& entity,
49 RenderPass& pass) const;
50
51 bool RenderSSBO(const ContentContext& renderer,
52 const Entity& entity,
53 RenderPass& pass) const;
54
55 bool RenderUniform(const ContentContext& renderer,
56 const Entity& entity,
57 RenderPass& pass) const;
58
59 Point center_;
60 Scalar radius_ = 0.0f;
61 std::vector<Color> colors_;
62 std::vector<Scalar> stops_;
63 Entity::TileMode tile_mode_;
64 Color decal_border_color_ = Color::BlackTransparent();
65 std::optional<Point> focus_;
66 Scalar focus_radius_ = 0.0f;
67
68 ConicalGradientContents(const ConicalGradientContents&) = delete;
69
70 ConicalGradientContents& operator=(const ConicalGradientContents&) = delete;
71 };
72
73 } // namespace impeller
74
75 #endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_CONICAL_GRADIENT_CONTENTS_H_
impeller::ColorSourceContents
Definition: color_source_contents.h:38
impeller::ConicalGradientContents
Definition: conical_gradient_contents.h:17
impeller::ConicalGradientContents::SetFocus
void SetFocus(std::optional< Point > focus, Scalar radius)
Definition: conical_gradient_contents.cc:68
impeller::ConicalGradientContents::ApplyColorFilter
bool ApplyColorFilter(const ColorFilterProc &color_filter_proc) override
If possible, applies a color filter to this contents inputs on the CPU.
Definition: conical_gradient_contents.cc:250
impeller::ConicalGradientContents::SetStops
void SetStops(std::vector< Scalar > stops)
Definition: conical_gradient_contents.cc:56
impeller::ConicalGradientContents::SetCenterAndRadius
void SetCenterAndRadius(Point center, Scalar radius)
Definition: conical_gradient_contents.cc:43
impeller::ConicalGradientContents::Render
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: conical_gradient_contents.cc:82
impeller::ConicalGradientContents::GetStops
const std::vector< Scalar > & GetStops() const
Definition: conical_gradient_contents.cc:64
impeller::ConicalGradientContents::ConicalGradientContents
ConicalGradientContents()
impeller::ConicalGradientContents::SetTileMode
void SetTileMode(Entity::TileMode tile_mode)
Definition: conical_gradient_contents.cc:48
impeller::ConicalGradientContents::GetColors
const std::vector< Color > & GetColors() const
Definition: conical_gradient_contents.cc:60
impeller::ConicalGradientContents::~ConicalGradientContents
~ConicalGradientContents() override
impeller::ConicalGradientContents::SetColors
void SetColors(std::vector< Color > colors)
Definition: conical_gradient_contents.cc:52
impeller::ContentContext
Definition: content_context.h:138
impeller::Contents::ColorFilterProc
std::function< Color(Color)> ColorFilterProc
Definition: contents.h:35
impeller::Entity
Definition: entity.h:26
impeller::Entity::TileMode
TileMode
Definition: entity.h:48
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
color.h
color_source_contents.h
entity.h
impeller
Definition: allocation.cc:12
impeller::Scalar
float Scalar
Definition: scalar.h:19
point.h
impeller::Color
Definition: color.h:124
impeller::Color::BlackTransparent
static constexpr Color BlackTransparent()
Definition: color.h:270
impeller::TPoint< Scalar >