Flutter Engine
 
Loading...
Searching...
No Matches
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
15
16namespace impeller {
17
19 public:
21
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 bool RenderUniform(const ContentContext& renderer,
58 const Entity& entity,
59 RenderPass& pass) const;
60
61 Point center_;
62 Scalar bias_;
63 Scalar scale_;
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 SweepGradientContents& operator=(const SweepGradientContents&) = delete;
72};
73
74} // namespace impeller
75
76#endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_SWEEP_GRADIENT_CONTENTS_H_
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition render_pass.h:30
void SetTileMode(Entity::TileMode tile_mode)
void SetCenterAndAngles(Point center, Degrees start_angle, Degrees end_angle)
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
bool ApplyColorFilter(const ColorFilterProc &color_filter_proc) override
If possible, applies a color filter to this contents inputs on the CPU.
bool IsOpaque(const Matrix &transform) const override
Whether this Contents only emits opaque source colors from the fragment stage. This value does not ac...
const std::vector< Color > & GetColors() const
const std::vector< Scalar > & GetStops() const
void SetStops(std::vector< Scalar > stops)
void SetColors(std::vector< Color > colors)
float Scalar
Definition scalar.h:19
std::function< Color(Color)> ColorFilterProc
static constexpr Color BlackTransparent()
Definition color.h:270
A 4x4 matrix using column-major storage.
Definition matrix.h:37