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 #pragma once
6 
7 #include <functional>
8 #include <memory>
9 #include <vector>
10 
11 #include "flutter/fml/macros.h"
14 #include "impeller/entity/entity.h"
17 #include "impeller/geometry/path.h"
19 
20 namespace impeller {
21 
23  public:
25 
26  ~LinearGradientContents() override;
27 
28  // |Contents|
29  bool IsOpaque() const override;
30 
31  // |Contents|
32  bool Render(const ContentContext& renderer,
33  const Entity& entity,
34  RenderPass& pass) const override;
35 
36  // |Contents|
37  [[nodiscard]] bool ApplyColorFilter(
38  const ColorFilterProc& color_filter_proc) override;
39 
40  void SetEndPoints(Point start_point, Point end_point);
41 
42  void SetColors(std::vector<Color> colors);
43 
44  void SetStops(std::vector<Scalar> stops);
45 
46  const std::vector<Color>& GetColors() const;
47 
48  const std::vector<Scalar>& GetStops() const;
49 
50  void SetTileMode(Entity::TileMode tile_mode);
51 
52  void SetDither(bool dither);
53 
54  private:
55  bool RenderTexture(const ContentContext& renderer,
56  const Entity& entity,
57  RenderPass& pass) const;
58 
59  bool RenderSSBO(const ContentContext& renderer,
60  const Entity& entity,
61  RenderPass& pass) const;
62 
63  Point start_point_;
64  Point end_point_;
65  std::vector<Color> colors_;
66  std::vector<Scalar> stops_;
67  Entity::TileMode tile_mode_;
68  Color decal_border_color_ = Color::BlackTransparent();
69  bool dither_ = false;
70 
71  FML_DISALLOW_COPY_AND_ASSIGN(LinearGradientContents);
72 };
73 
74 } // namespace impeller
path.h
point.h
entity.h
impeller::Color
Definition: color.h:122
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:194
impeller::LinearGradientContents::Render
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: linear_gradient_contents.cc:63
impeller::LinearGradientContents::SetEndPoints
void SetEndPoints(Point start_point, Point end_point)
Definition: linear_gradient_contents.cc:22
impeller::LinearGradientContents::SetColors
void SetColors(std::vector< Color > colors)
Definition: linear_gradient_contents.cc:27
gradient.h
impeller::LinearGradientContents::SetTileMode
void SetTileMode(Entity::TileMode tile_mode)
Definition: linear_gradient_contents.cc:43
impeller::Entity
Definition: entity.h:21
color_source_contents.h
impeller::LinearGradientContents::GetColors
const std::vector< Color > & GetColors() const
Definition: linear_gradient_contents.cc:35
impeller::Contents::ColorFilterProc
std::function< Color(Color)> ColorFilterProc
Definition: contents.h:37
impeller::LinearGradientContents::SetDither
void SetDither(bool dither)
Definition: linear_gradient_contents.cc:59
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:47
impeller::Entity::TileMode
TileMode
Definition: entity.h:40
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:27
impeller::LinearGradientContents::LinearGradientContents
LinearGradientContents()
impeller::TPoint< Scalar >
impeller::LinearGradientContents::SetStops
void SetStops(std::vector< Scalar > stops)
Definition: linear_gradient_contents.cc:31
impeller::Color::BlackTransparent
static constexpr Color BlackTransparent()
Definition: color.h:260
texture.h
impeller::LinearGradientContents::GetStops
const std::vector< Scalar > & GetStops() const
Definition: linear_gradient_contents.cc:39
color.h
impeller::LinearGradientContents
Definition: linear_gradient_contents.h:22
impeller::ColorSourceContents
Definition: color_source_contents.h:33
impeller
Definition: aiks_context.cc:10
impeller::LinearGradientContents::~LinearGradientContents
~LinearGradientContents() override
impeller::ContentContext
Definition: content_context.h:344