| Flutter Impeller |

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 #pragma once
6
7 #include <functional>
8 #include <memory>
9 #include <vector>
10
11 #include "flutter/fml/macros.h"
12 #include "impeller/entity/contents/color_source_contents.h"
13 #include "impeller/entity/entity.h"
14 #include "impeller/geometry/color.h"
15 #include "impeller/geometry/gradient.h"
16 #include "impeller/geometry/path.h"
17 #include "impeller/geometry/point.h"
18
19 namespace impeller {
20
21 class ConicalGradientContents final : public ColorSourceContents {
22 public:
23 ConicalGradientContents();
24
25 ~ConicalGradientContents() 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 SetCenterAndRadius(Point center, Scalar radius);
37
38 void SetColors(std::vector<Color> colors);
39
40 void SetStops(std::vector<Scalar> stops);
41
42 const std::vector<Color>& GetColors() const;
43
44 const std::vector<Scalar>& GetStops() const;
45
46 void SetTileMode(Entity::TileMode tile_mode);
47
48 void SetDither(bool dither);
49
50 void SetFocus(std::optional<Point> focus, Scalar radius);
51
52 private:
53 bool RenderTexture(const ContentContext& renderer,
54 const Entity& entity,
55 RenderPass& pass) const;
56
57 bool RenderSSBO(const ContentContext& renderer,
58 const Entity& entity,
59 RenderPass& pass) const;
60 Point center_;
61 Scalar radius_ = 0.0f;
62 std::vector<Color> colors_;
63 std::vector<Scalar> stops_;
64 Entity::TileMode tile_mode_;
65 Color decal_border_color_ = Color::BlackTransparent();
66 std::optional<Point> focus_;
67 Scalar focus_radius_ = 0.0f;
68 bool dither_ = false;
69
70 FML_DISALLOW_COPY_AND_ASSIGN(ConicalGradientContents);
71 };
72
73 } // namespace impeller
path.h
impeller::ConicalGradientContents::GetStops
const std::vector< Scalar > & GetStops() const
Definition: conical_gradient_contents.cc:48
point.h
impeller::Scalar
float Scalar
Definition: scalar.h:15
entity.h
impeller::Color
Definition: color.h:122
impeller::ConicalGradientContents::SetColors
void SetColors(std::vector< Color > colors)
Definition: conical_gradient_contents.cc:36
impeller::ConicalGradientContents::SetFocus
void SetFocus(std::optional< Point > focus, Scalar radius)
Definition: conical_gradient_contents.cc:52
impeller::ConicalGradientContents::SetCenterAndRadius
void SetCenterAndRadius(Point center, Scalar radius)
Definition: conical_gradient_contents.cc:23
impeller::ConicalGradientContents::ConicalGradientContents
ConicalGradientContents()
gradient.h
impeller::Entity
Definition: entity.h:21
impeller::ConicalGradientContents
Definition: conical_gradient_contents.h:21
color_source_contents.h
impeller::Contents::ColorFilterProc
std::function< Color(Color)> ColorFilterProc
Definition: contents.h:37
impeller::ConicalGradientContents::SetDither
void SetDither(bool dither)
Definition: conical_gradient_contents.cc:32
impeller::ConicalGradientContents::Render
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: conical_gradient_contents.cc:58
impeller::ConicalGradientContents::SetStops
void SetStops(std::vector< Scalar > stops)
Definition: conical_gradient_contents.cc:40
impeller::Entity::TileMode
TileMode
Definition: entity.h:40
impeller::ConicalGradientContents::~ConicalGradientContents
~ConicalGradientContents() override
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:27
impeller::ConicalGradientContents::GetColors
const std::vector< Color > & GetColors() const
Definition: conical_gradient_contents.cc:44
impeller::TPoint
Definition: point.h:20
impeller::Color::BlackTransparent
static constexpr Color BlackTransparent()
Definition: color.h:260
color.h
impeller::ConicalGradientContents::SetTileMode
void SetTileMode(Entity::TileMode tile_mode)
Definition: conical_gradient_contents.cc:28
impeller::ColorSourceContents
Definition: color_source_contents.h:33
impeller
Definition: aiks_context.cc:10
impeller::ConicalGradientContents::ApplyColorFilter
bool ApplyColorFilter(const ColorFilterProc &color_filter_proc) override
If possible, applies a color filter to this contents inputs on the CPU.
Definition: conical_gradient_contents.cc:203
impeller::ContentContext
Definition: content_context.h:344