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 
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  Point center_;
55  Scalar radius_ = 0.0f;
56  std::vector<Color> colors_;
57  std::vector<Scalar> stops_;
58  Entity::TileMode tile_mode_;
59  Color decal_border_color_ = Color::BlackTransparent();
60  std::optional<Point> focus_;
61  Scalar focus_radius_ = 0.0f;
62 
64 
65  ConicalGradientContents& operator=(const ConicalGradientContents&) = delete;
66 };
67 
68 } // namespace impeller
69 
70 #endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_CONICAL_GRADIENT_CONTENTS_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:123
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()
impeller::Entity
Definition: entity.h:20
impeller::ConicalGradientContents
Definition: conical_gradient_contents.h:17
color_source_contents.h
impeller::Contents::ColorFilterProc
std::function< Color(Color)> ColorFilterProc
Definition: contents.h:35
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:42
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:33
impeller::ConicalGradientContents::GetColors
const std::vector< Color > & GetColors() const
Definition: conical_gradient_contents.cc:38
impeller::TPoint
Definition: point.h:27
impeller::Color::BlackTransparent
static constexpr Color BlackTransparent()
Definition: color.h:269
color.h
impeller::ConicalGradientContents::SetTileMode
void SetTileMode(Entity::TileMode tile_mode)
Definition: conical_gradient_contents.cc:26
impeller::ColorSourceContents
Definition: color_source_contents.h:37
impeller
Definition: allocation.cc:12
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:170
impeller::ContentContext
Definition: content_context.h:366