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 
11 #include "impeller/entity/entity.h"
14 
15 namespace impeller {
16 
18  public:
20 
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 
69 
70  ConicalGradientContents& operator=(const ConicalGradientContents&) = delete;
71 };
72 
73 } // namespace impeller
74 
75 #endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_CONICAL_GRADIENT_CONTENTS_H_
void SetFocus(std::optional< Point > focus, Scalar radius)
bool ApplyColorFilter(const ColorFilterProc &color_filter_proc) override
If possible, applies a color filter to this contents inputs on the CPU.
void SetStops(std::vector< Scalar > stops)
void SetCenterAndRadius(Point center, Scalar radius)
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
const std::vector< Scalar > & GetStops() const
void SetTileMode(Entity::TileMode tile_mode)
const std::vector< Color > & GetColors() const
void SetColors(std::vector< Color > colors)
std::function< Color(Color)> ColorFilterProc
Definition: contents.h:35
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
float Scalar
Definition: scalar.h:19
static constexpr Color BlackTransparent()
Definition: color.h:270