Flutter Impeller
uber_sdf_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_UBER_SDF_CONTENTS_H_
6 #define FLUTTER_IMPELLER_ENTITY_CONTENTS_UBER_SDF_CONTENTS_H_
7 
8 #include <memory>
9 
15 #include "impeller/geometry/rect.h"
16 
17 namespace impeller {
18 
20  public:
21  static std::unique_ptr<UberSDFContents> Make(
22  const UberSDFParameters& params,
23  std::unique_ptr<Geometry> geometry);
24 
25  ~UberSDFContents() override;
26 
27  bool Render(const ContentContext& renderer,
28  const Entity& entity,
29  RenderPass& pass) const override;
30 
31  std::optional<Rect> GetCoverage(const Entity& entity) const override;
32 
33  Color GetColor() const;
34 
35  bool ApplyColorFilter(const ColorFilterProc& color_filter_proc) override;
36 
37  const Geometry* GetGeometry() const override;
38 
39  std::optional<Color> AsBackgroundColor(const Entity& entity,
40  ISize target_size) const override;
41 
42  private:
43  explicit UberSDFContents(const UberSDFParameters& params,
44  std::unique_ptr<Geometry> geometry);
45 
46  UberSDFParameters params_;
47  std::unique_ptr<Geometry> geometry_;
48 
49  UberSDFContents(const UberSDFContents&) = delete;
50 
51  UberSDFContents& operator=(const UberSDFContents&) = delete;
52 };
53 
54 } // namespace impeller
55 
56 #endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_UBER_SDF_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:30
std::optional< Rect > GetCoverage(const Entity &entity) const override
Get the area of the render pass that will be affected when this contents is rendered.
bool ApplyColorFilter(const ColorFilterProc &color_filter_proc) override
If possible, applies a color filter to this contents inputs on the CPU.
static std::unique_ptr< UberSDFContents > Make(const UberSDFParameters &params, std::unique_ptr< Geometry > geometry)
std::optional< Color > AsBackgroundColor(const Entity &entity, ISize target_size) const override
Returns a color if this Contents will flood the given target_size with a color. This output color is ...
const Geometry * GetGeometry() const override
Get the geometry that this contents will use to render.
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Parameters for rendering shapes using the UberSDF shader.