Flutter Engine
The Flutter Engine
conical_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_CONICAL_GRADIENT_CONTENTS_H_
6#define FLUTTER_IMPELLER_ENTITY_CONTENTS_CONICAL_GRADIENT_CONTENTS_H_
7
8#include <vector>
9
14
15namespace impeller {
16
18 public:
20
22
23 // |Contents|
24 bool Render(const ContentContext& renderer,
25 const Entity& entity,
26 RenderPass& pass) const override;
27
28 // |Contents|
29 [[nodiscard]] bool ApplyColorFilter(
30 const ColorFilterProc& color_filter_proc) override;
31
32 void SetCenterAndRadius(Point center, Scalar radius);
33
34 void SetColors(std::vector<Color> colors);
35
36 void SetStops(std::vector<Scalar> stops);
37
38 const std::vector<Color>& GetColors() const;
39
40 const std::vector<Scalar>& GetStops() const;
41
42 void SetTileMode(Entity::TileMode tile_mode);
43
44 void SetFocus(std::optional<Point> focus, Scalar radius);
45
46 private:
47 bool RenderTexture(const ContentContext& renderer,
48 const Entity& entity,
49 RenderPass& pass) const;
50
51 bool RenderSSBO(const ContentContext& renderer,
52 const Entity& entity,
53 RenderPass& pass) const;
54 Point center_;
55 Scalar radius_ = 0.0f;
56 std::vector<Color> colors_;
57 std::vector<Scalar> stops_;
58 Entity::TileMode tile_mode_;
59 Color decal_border_color_ = Color::BlackTransparent();
60 std::optional<Point> focus_;
61 Scalar focus_radius_ = 0.0f;
62
64
65 ConicalGradientContents& operator=(const ConicalGradientContents&) = delete;
66};
67
68} // namespace impeller
69
70#endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_CONICAL_GRADIENT_CONTENTS_H_
void SetFocus(std::optional< Point > focus, Scalar radius)
bool ApplyColorFilter(const ColorFilterProc &color_filter_proc) override
If possible, applies a color filter to this contents inputs on the CPU.
void SetStops(std::vector< Scalar > stops)
void SetCenterAndRadius(Point center, Scalar radius)
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
const std::vector< Scalar > & GetStops() const
void SetTileMode(Entity::TileMode tile_mode)
const std::vector< Color > & GetColors() const
void SetColors(std::vector< Color > colors)
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
PODArray< SkColor > colors
Definition: SkRecords.h:276
float Scalar
Definition: scalar.h:18
static constexpr Color BlackTransparent()
Definition: color.h:272