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:
19  explicit ConicalGradientContents(const Geometry* geometry);
20 
22 
23  const Geometry* GetGeometry() const override;
24 
25  // |Contents|
26  bool Render(const ContentContext& renderer,
27  const Entity& entity,
28  RenderPass& pass) const override;
29 
30  // |Contents|
31  [[nodiscard]] bool ApplyColorFilter(
32  const ColorFilterProc& color_filter_proc) override;
33 
34  void SetCenterAndRadius(Point center, Scalar radius);
35 
36  void SetColors(std::vector<Color> colors);
37 
38  void SetStops(std::vector<Scalar> stops);
39 
40  const std::vector<Color>& GetColors() const;
41 
42  const std::vector<Scalar>& GetStops() const;
43 
44  void SetTileMode(Entity::TileMode tile_mode);
45 
46  void SetFocus(std::optional<Point> focus, Scalar radius);
47 
48  private:
49  bool RenderTexture(const ContentContext& renderer,
50  const Entity& entity,
51  RenderPass& pass) const;
52 
53  bool RenderSSBO(const ContentContext& renderer,
54  const Entity& entity,
55  RenderPass& pass) const;
56 
57  bool RenderUniform(const ContentContext& renderer,
58  const Entity& entity,
59  RenderPass& pass) const;
60 
61  const Geometry* geometry_ = nullptr;
62  Point center_;
63  Scalar radius_ = 0.0f;
64  std::vector<Color> colors_;
65  std::vector<Scalar> stops_;
66  Entity::TileMode tile_mode_;
67  Color decal_border_color_ = Color::BlackTransparent();
68  std::optional<Point> focus_;
69  Scalar focus_radius_ = 0.0f;
70 
72 
73  ConicalGradientContents& operator=(const ConicalGradientContents&) = delete;
74 };
75 
76 } // namespace impeller
77 
78 #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)
const Geometry * GetGeometry() const override
Get the geometry that this contents will use to render.
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
ConicalGradientContents(const Geometry *geometry)
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