Flutter Impeller
linear_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_LINEAR_GRADIENT_CONTENTS_H_
6 #define FLUTTER_IMPELLER_ENTITY_CONTENTS_LINEAR_GRADIENT_CONTENTS_H_
7 
8 #include <functional>
9 #include <memory>
10 #include <vector>
11 
12 #include "flutter/fml/macros.h"
15 #include "impeller/entity/entity.h"
18 #include "impeller/geometry/path.h"
20 
21 namespace impeller {
22 
24  public:
26 
27  ~LinearGradientContents() override;
28 
29  // |Contents|
30  bool IsOpaque() const override;
31 
32  // |Contents|
33  bool Render(const ContentContext& renderer,
34  const Entity& entity,
35  RenderPass& pass) const override;
36 
37  // |Contents|
38  [[nodiscard]] bool ApplyColorFilter(
39  const ColorFilterProc& color_filter_proc) override;
40 
41  void SetEndPoints(Point start_point, Point end_point);
42 
43  void SetColors(std::vector<Color> colors);
44 
45  void SetStops(std::vector<Scalar> stops);
46 
47  const std::vector<Color>& GetColors() const;
48 
49  const std::vector<Scalar>& GetStops() const;
50 
51  void SetTileMode(Entity::TileMode tile_mode);
52 
53  private:
54  bool RenderTexture(const ContentContext& renderer,
55  const Entity& entity,
56  RenderPass& pass) const;
57 
58  bool RenderSSBO(const ContentContext& renderer,
59  const Entity& entity,
60  RenderPass& pass) const;
61 
62  Point start_point_;
63  Point end_point_;
64  std::vector<Color> colors_;
65  std::vector<Scalar> stops_;
66  Entity::TileMode tile_mode_;
67  Color decal_border_color_ = Color::BlackTransparent();
68 
70 
71  LinearGradientContents& operator=(const LinearGradientContents&) = delete;
72 };
73 
74 } // namespace impeller
75 
76 #endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_LINEAR_GRADIENT_CONTENTS_H_
path.h
point.h
entity.h
impeller::Color
Definition: color.h:124
impeller::LinearGradientContents::ApplyColorFilter
bool ApplyColorFilter(const ColorFilterProc &color_filter_proc) override
If possible, applies a color filter to this contents inputs on the CPU.
Definition: linear_gradient_contents.cc:157
impeller::LinearGradientContents::Render
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: linear_gradient_contents.cc:56
impeller::LinearGradientContents::SetEndPoints
void SetEndPoints(Point start_point, Point end_point)
Definition: linear_gradient_contents.cc:19
impeller::LinearGradientContents::SetColors
void SetColors(std::vector< Color > colors)
Definition: linear_gradient_contents.cc:24
gradient.h
impeller::LinearGradientContents::SetTileMode
void SetTileMode(Entity::TileMode tile_mode)
Definition: linear_gradient_contents.cc:40
impeller::Entity
Definition: entity.h:21
color_source_contents.h
impeller::LinearGradientContents::GetColors
const std::vector< Color > & GetColors() const
Definition: linear_gradient_contents.cc:32
impeller::Contents::ColorFilterProc
std::function< Color(Color)> ColorFilterProc
Definition: contents.h:38
impeller::LinearGradientContents::IsOpaque
bool IsOpaque() const override
Whether this Contents only emits opaque source colors from the fragment stage. This value does not ac...
Definition: linear_gradient_contents.cc:44
impeller::Entity::TileMode
TileMode
Definition: entity.h:42
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:33
impeller::LinearGradientContents::LinearGradientContents
LinearGradientContents()
impeller::TPoint< Scalar >
impeller::LinearGradientContents::SetStops
void SetStops(std::vector< Scalar > stops)
Definition: linear_gradient_contents.cc:28
impeller::Color::BlackTransparent
static constexpr Color BlackTransparent()
Definition: color.h:262
texture.h
impeller::LinearGradientContents::GetStops
const std::vector< Scalar > & GetStops() const
Definition: linear_gradient_contents.cc:36
color.h
impeller::LinearGradientContents
Definition: linear_gradient_contents.h:23
impeller::ColorSourceContents
Definition: color_source_contents.h:36
impeller
Definition: aiks_blur_unittests.cc:20
impeller::LinearGradientContents::~LinearGradientContents
~LinearGradientContents() override
impeller::ContentContext
Definition: content_context.h:392