| 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 <functional>
9 #include <memory>
10 #include <vector>
11
12 #include "flutter/fml/macros.h"
13 #include "impeller/entity/contents/color_source_contents.h"
14 #include "impeller/entity/entity.h"
15 #include "impeller/geometry/color.h"
16 #include "impeller/geometry/gradient.h"
17 #include "impeller/geometry/path.h"
18 #include "impeller/geometry/point.h"
19
20 namespace impeller {
21
22 class ConicalGradientContents final : public ColorSourceContents {
23 public:
24 ConicalGradientContents();
25
26 ~ConicalGradientContents() override;
27
28 // |Contents|
29 bool Render(const ContentContext& renderer,
30 const Entity& entity,
31 RenderPass& pass) const override;
32
33 // |Contents|
34 [[nodiscard]] bool ApplyColorFilter(
35 const ColorFilterProc& color_filter_proc) override;
36
37 void SetCenterAndRadius(Point center, Scalar radius);
38
39 void SetColors(std::vector<Color> colors);
40
41 void SetStops(std::vector<Scalar> stops);
42
43 const std::vector<Color>& GetColors() const;
44
45 const std::vector<Scalar>& GetStops() const;
46
47 void SetTileMode(Entity::TileMode tile_mode);
48
49 void SetFocus(std::optional<Point> focus, Scalar radius);
50
51 private:
52 bool RenderTexture(const ContentContext& renderer,
53 const Entity& entity,
54 RenderPass& pass) const;
55
56 bool RenderSSBO(const ContentContext& renderer,
57 const Entity& entity,
58 RenderPass& pass) const;
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_
path.h
impeller::ConicalGradientContents::GetStops
const std::vector< Scalar > & GetStops() const
Definition: conical_gradient_contents.cc:42
point.h
impeller::Scalar
float Scalar
Definition: scalar.h:18
entity.h
impeller::Color
Definition: color.h:124
impeller::ConicalGradientContents::SetColors
void SetColors(std::vector< Color > colors)
Definition: conical_gradient_contents.cc:30
impeller::ConicalGradientContents::SetFocus
void SetFocus(std::optional< Point > focus, Scalar radius)
Definition: conical_gradient_contents.cc:46
impeller::ConicalGradientContents::SetCenterAndRadius
void SetCenterAndRadius(Point center, Scalar radius)
Definition: conical_gradient_contents.cc:21
impeller::ConicalGradientContents::ConicalGradientContents
ConicalGradientContents()
gradient.h
impeller::Entity
Definition: entity.h:21
impeller::ConicalGradientContents
Definition: conical_gradient_contents.h:22
color_source_contents.h
impeller::Contents::ColorFilterProc
std::function< Color(Color)> ColorFilterProc
Definition: contents.h:38
impeller::ConicalGradientContents::Render
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: conical_gradient_contents.cc:52
impeller::ConicalGradientContents::SetStops
void SetStops(std::vector< Scalar > stops)
Definition: conical_gradient_contents.cc:34
impeller::Entity::TileMode
TileMode
Definition: entity.h:40
impeller::ConicalGradientContents::~ConicalGradientContents
~ConicalGradientContents() override
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:29
impeller::ConicalGradientContents::GetColors
const std::vector< Color > & GetColors() const
Definition: conical_gradient_contents.cc:38
impeller::TPoint
Definition: point.h:22
impeller::Color::BlackTransparent
static constexpr Color BlackTransparent()
Definition: color.h:262
color.h
impeller::ConicalGradientContents::SetTileMode
void SetTileMode(Entity::TileMode tile_mode)
Definition: conical_gradient_contents.cc:26
impeller::ColorSourceContents
Definition: color_source_contents.h:34
impeller
Definition: aiks_context.cc:10
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:195
impeller::ContentContext
Definition: content_context.h:332