Flutter Impeller
radial_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_RADIAL_GRADIENT_CONTENTS_H_
6 #define FLUTTER_IMPELLER_ENTITY_CONTENTS_RADIAL_GRADIENT_CONTENTS_H_
7 
8 #include <vector>
9 
11 #include "impeller/entity/entity.h"
14 
15 namespace impeller {
16 
18  public:
20 
21  ~RadialGradientContents() override;
22 
23  // |Contents|
24  bool IsOpaque() const override;
25 
26  // |Contents|
27  bool Render(const ContentContext& renderer,
28  const Entity& entity,
29  RenderPass& pass) const override;
30 
31  // |Contents|
32  [[nodiscard]] bool ApplyColorFilter(
33  const ColorFilterProc& color_filter_proc) override;
34 
35  void SetCenterAndRadius(Point center, Scalar radius);
36 
37  void SetColors(std::vector<Color> colors);
38 
39  void SetStops(std::vector<Scalar> stops);
40 
41  const std::vector<Color>& GetColors() const;
42 
43  const std::vector<Scalar>& GetStops() const;
44 
45  void SetTileMode(Entity::TileMode tile_mode);
46 
47  private:
48  bool RenderTexture(const ContentContext& renderer,
49  const Entity& entity,
50  RenderPass& pass) const;
51 
52  bool RenderSSBO(const ContentContext& renderer,
53  const Entity& entity,
54  RenderPass& pass) const;
55  Point center_;
56  Scalar radius_;
57  std::vector<Color> colors_;
58  std::vector<Scalar> stops_;
59  Entity::TileMode tile_mode_;
60  Color decal_border_color_ = Color::BlackTransparent();
61 
63 
64  RadialGradientContents& operator=(const RadialGradientContents&) = delete;
65 };
66 
67 } // namespace impeller
68 
69 #endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_RADIAL_GRADIENT_CONTENTS_H_
impeller::RadialGradientContents::SetCenterAndRadius
void SetCenterAndRadius(Point center, Scalar radius)
Definition: radial_gradient_contents.cc:21
point.h
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::RadialGradientContents::SetStops
void SetStops(std::vector< Scalar > stops)
Definition: radial_gradient_contents.cc:34
entity.h
impeller::RadialGradientContents::GetStops
const std::vector< Scalar > & GetStops() const
Definition: radial_gradient_contents.cc:42
impeller::Color
Definition: color.h:124
impeller::RadialGradientContents::~RadialGradientContents
~RadialGradientContents() override
impeller::RadialGradientContents::IsOpaque
bool IsOpaque() const override
Whether this Contents only emits opaque source colors from the fragment stage. This value does not ac...
Definition: radial_gradient_contents.cc:46
impeller::RadialGradientContents::Render
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: radial_gradient_contents.cc:58
impeller::Entity
Definition: entity.h:21
color_source_contents.h
impeller::Contents::ColorFilterProc
std::function< Color(Color)> ColorFilterProc
Definition: contents.h:38
impeller::RadialGradientContents::GetColors
const std::vector< Color > & GetColors() const
Definition: radial_gradient_contents.cc:38
impeller::Entity::TileMode
TileMode
Definition: entity.h:42
impeller::RadialGradientContents::RadialGradientContents
RadialGradientContents()
impeller::RadialGradientContents::ApplyColorFilter
bool ApplyColorFilter(const ColorFilterProc &color_filter_proc) override
If possible, applies a color filter to this contents inputs on the CPU.
Definition: radial_gradient_contents.cc:159
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:33
impeller::RadialGradientContents::SetTileMode
void SetTileMode(Entity::TileMode tile_mode)
Definition: radial_gradient_contents.cc:26
impeller::TPoint< Scalar >
impeller::Color::BlackTransparent
static constexpr Color BlackTransparent()
Definition: color.h:262
color.h
impeller::ColorSourceContents
Definition: color_source_contents.h:36
impeller::RadialGradientContents
Definition: radial_gradient_contents.h:17
impeller::RadialGradientContents::SetColors
void SetColors(std::vector< Color > colors)
Definition: radial_gradient_contents.cc:30
impeller
Definition: aiks_blur_unittests.cc:20
impeller::ContentContext
Definition: content_context.h:392