Flutter Engine
The Flutter Engine
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 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_
std::function< Color(Color)> ColorFilterProc
Definition: contents.h:35
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:33
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 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)
PODArray< SkColor > colors
Definition: SkRecords.h:276
float Scalar
Definition: scalar.h:18
static constexpr Color BlackTransparent()
Definition: color.h:272