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