Flutter Impeller
solid_color_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_SOLID_COLOR_CONTENTS_H_
6 #define FLUTTER_IMPELLER_ENTITY_CONTENTS_SOLID_COLOR_CONTENTS_H_
7 
11 
12 namespace impeller {
13 
15  public:
16  explicit SolidColorContents(const Geometry* geometry);
17 
18  ~SolidColorContents() override;
19 
20  void SetColor(Color color);
21 
22  Color GetColor() const;
23 
24  // |ColorSourceContents|
25  bool IsSolidColor() const override;
26 
27  const Geometry* GetGeometry() const override;
28 
29  // |Contents|
30  bool IsOpaque(const Matrix& transform) const override;
31 
32  // |Contents|
33  std::optional<Rect> GetCoverage(const Entity& entity) const override;
34 
35  // |Contents|
36  bool Render(const ContentContext& renderer,
37  const Entity& entity,
38  RenderPass& pass) const override;
39 
40  std::optional<Color> AsBackgroundColor(const Entity& entity,
41  ISize target_size) const override;
42 
43  // |Contents|
44  [[nodiscard]] bool ApplyColorFilter(
45  const ColorFilterProc& color_filter_proc) override;
46 
47  private:
48  const Geometry* geometry_ = nullptr;
49  Color color_;
50 
51  SolidColorContents(const SolidColorContents&) = delete;
52 
53  SolidColorContents& operator=(const SolidColorContents&) = delete;
54 };
55 
56 } // namespace impeller
57 
58 #endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_SOLID_COLOR_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
bool IsOpaque(const Matrix &transform) const override
Whether this Contents only emits opaque source colors from the fragment stage. This value does not ac...
bool IsSolidColor() const override
bool ApplyColorFilter(const ColorFilterProc &color_filter_proc) override
If possible, applies a color filter to this contents inputs on the CPU.
SolidColorContents(const Geometry *geometry)
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
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 ...
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.
const Geometry * GetGeometry() const override
Get the geometry that this contents will use to render.
A 4x4 matrix using column-major storage.
Definition: matrix.h:37