Flutter Impeller
sweep_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_SWEEP_GRADIENT_CONTENTS_H_
6 #define FLUTTER_IMPELLER_ENTITY_CONTENTS_SWEEP_GRADIENT_CONTENTS_H_
7 
8 #include <vector>
9 
11 #include "impeller/entity/entity.h"
15 
16 namespace impeller {
17 
19  public:
21 
22  ~SweepGradientContents() override;
23 
24  // |Contents|
25  bool IsOpaque(const Matrix& transform) const override;
26 
27  // |Contents|
28  bool Render(const ContentContext& renderer,
29  const Entity& entity,
30  RenderPass& pass) const override;
31 
32  // |Contents|
33  [[nodiscard]] bool ApplyColorFilter(
34  const ColorFilterProc& color_filter_proc) override;
35 
36  void SetCenterAndAngles(Point center, Degrees start_angle, Degrees end_angle);
37 
38  void SetColors(std::vector<Color> colors);
39 
40  void SetStops(std::vector<Scalar> stops);
41 
42  void SetTileMode(Entity::TileMode tile_mode);
43 
44  const std::vector<Color>& GetColors() const;
45 
46  const std::vector<Scalar>& GetStops() const;
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  Point center_;
58  Scalar bias_;
59  Scalar scale_;
60  std::vector<Color> colors_;
61  std::vector<Scalar> stops_;
62  Entity::TileMode tile_mode_;
63  Color decal_border_color_ = Color::BlackTransparent();
64 
66 
67  SweepGradientContents& operator=(const SweepGradientContents&) = delete;
68 };
69 
70 } // namespace impeller
71 
72 #endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_SWEEP_GRADIENT_CONTENTS_H_
impeller::SweepGradientContents::ApplyColorFilter
bool ApplyColorFilter(const ColorFilterProc &color_filter_proc) override
If possible, applies a color filter to this contents inputs on the CPU.
Definition: sweep_gradient_contents.cc:174
impeller::SweepGradientContents::SetTileMode
void SetTileMode(Entity::TileMode tile_mode)
Definition: sweep_gradient_contents.cc:40
point.h
impeller::Scalar
float Scalar
Definition: scalar.h:18
entity.h
impeller::SweepGradientContents::SetColors
void SetColors(std::vector< Color > colors)
Definition: sweep_gradient_contents.cc:32
impeller::SweepGradientContents::SetCenterAndAngles
void SetCenterAndAngles(Point center, Degrees start_angle, Degrees end_angle)
Definition: sweep_gradient_contents.cc:21
impeller::Color
Definition: color.h:123
impeller::SweepGradientContents::~SweepGradientContents
~SweepGradientContents() override
impeller::SweepGradientContents::GetStops
const std::vector< Scalar > & GetStops() const
Definition: sweep_gradient_contents.cc:48
impeller::SweepGradientContents
Definition: sweep_gradient_contents.h:18
impeller::Entity
Definition: entity.h:20
color_source_contents.h
impeller::SweepGradientContents::SetStops
void SetStops(std::vector< Scalar > stops)
Definition: sweep_gradient_contents.cc:36
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:213
impeller::Contents::ColorFilterProc
std::function< Color(Color)> ColorFilterProc
Definition: contents.h:35
impeller::SweepGradientContents::SweepGradientContents
SweepGradientContents()
impeller::Entity::TileMode
TileMode
Definition: entity.h:42
scalar.h
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:33
impeller::SweepGradientContents::Render
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: sweep_gradient_contents.cc:64
impeller::TPoint< Scalar >
impeller::Color::BlackTransparent
static constexpr Color BlackTransparent()
Definition: color.h:269
impeller::Degrees
Definition: scalar.h:51
color.h
impeller::SweepGradientContents::GetColors
const std::vector< Color > & GetColors() const
Definition: sweep_gradient_contents.cc:44
impeller::ColorSourceContents
Definition: color_source_contents.h:37
impeller
Definition: allocation.cc:12
impeller::ContentContext
Definition: content_context.h:366
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::SweepGradientContents::IsOpaque
bool IsOpaque(const Matrix &transform) const override
Whether this Contents only emits opaque source colors from the fragment stage. This value does not ac...
Definition: sweep_gradient_contents.cc:52