Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
radial_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_RADIAL_GRADIENT_CONTENTS_H_
6#define FLUTTER_IMPELLER_ENTITY_CONTENTS_RADIAL_GRADIENT_CONTENTS_H_
7
8#include <vector>
9
14
15namespace impeller {
16
18 public:
19 explicit RadialGradientContents(const Geometry* geometry);
20
22
23 const Geometry* GetGeometry() const override;
24
25 // |Contents|
26 bool IsOpaque(const Matrix& transform) const override;
27
28 // |Contents|
29 bool Render(const ContentContext& renderer,
30 const Entity& entity,
31 RenderPass& pass) const override;
32
33 // |Contents|
34 [[nodiscard]] bool ApplyColorFilter(
35 const ColorFilterProc& color_filter_proc) override;
36
37 void SetCenterAndRadius(Point center, Scalar radius);
38
39 void SetColors(std::vector<Color> colors);
40
41 void SetStops(std::vector<Scalar> stops);
42
43 const std::vector<Color>& GetColors() const;
44
45 const std::vector<Scalar>& GetStops() const;
46
47 void SetTileMode(Entity::TileMode tile_mode);
48
49 private:
50 bool RenderTexture(const ContentContext& renderer,
51 const Entity& entity,
52 RenderPass& pass) const;
53
54 bool RenderSSBO(const ContentContext& renderer,
55 const Entity& entity,
56 RenderPass& pass) const;
57
58 bool RenderUniform(const ContentContext& renderer,
59 const Entity& entity,
60 RenderPass& pass) const;
61
62 const Geometry* geometry_ = nullptr;
63 Point center_;
64 Scalar radius_;
65 std::vector<Color> colors_;
66 std::vector<Scalar> stops_;
67 Entity::TileMode tile_mode_;
68 Color decal_border_color_ = Color::BlackTransparent();
69
71
72 RadialGradientContents& operator=(const RadialGradientContents&) = delete;
73};
74
75} // namespace impeller
76
77#endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_RADIAL_GRADIENT_CONTENTS_H_
bool IsOpaque(const Matrix &transform) const override
Whether this Contents only emits opaque source colors from the fragment stage. This value does not ac...
void SetTileMode(Entity::TileMode tile_mode)
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
void SetCenterAndRadius(Point center, Scalar radius)
const Geometry * GetGeometry() const override
Get the geometry that this contents will use to render.
void SetStops(std::vector< Scalar > stops)
bool ApplyColorFilter(const ColorFilterProc &color_filter_proc) override
If possible, applies a color filter to this contents inputs on the CPU.
void SetColors(std::vector< Color > colors)
const std::vector< Scalar > & GetStops() const
const std::vector< Color > & GetColors() const
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition render_pass.h:30
float Scalar
Definition scalar.h:19
std::function< Color(Color)> ColorFilterProc
static constexpr Color BlackTransparent()
Definition color.h:275
A 4x4 matrix using column-major storage.
Definition matrix.h:37