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 #pragma once
6 
7 #include <functional>
8 #include <memory>
9 #include <vector>
10 
11 #include "flutter/fml/macros.h"
16 #include "impeller/geometry/path.h"
17 
18 namespace impeller {
19 
20 class Path;
21 class HostBuffer;
22 struct VertexBuffer;
23 
25  public:
27 
28  ~SolidColorContents() override;
29 
30  static std::unique_ptr<SolidColorContents> Make(const Path& path,
31  Color color);
32 
33  void SetColor(Color color);
34 
35  Color GetColor() const;
36 
37  // |ColorSourceContents|
38  bool IsSolidColor() const override;
39 
40  // |Contents|
41  bool IsOpaque() const override;
42 
43  // |Contents|
44  std::optional<Rect> GetCoverage(const Entity& entity) const override;
45 
46  // |Contents|
47  bool Render(const ContentContext& renderer,
48  const Entity& entity,
49  RenderPass& pass) const override;
50 
51  std::optional<Color> AsBackgroundColor(const Entity& entity,
52  ISize target_size) const override;
53 
54  // |Contents|
55  [[nodiscard]] bool ApplyColorFilter(
56  const ColorFilterProc& color_filter_proc) override;
57 
58  private:
59  Color color_;
60 
61  FML_DISALLOW_COPY_AND_ASSIGN(SolidColorContents);
62 };
63 
64 } // namespace impeller
impeller::SolidColorContents::GetColor
Color GetColor() const
Definition: solid_color_contents.cc:23
impeller::SolidColorContents::Make
static std::unique_ptr< SolidColorContents > Make(const Path &path, Color color)
Definition: solid_color_contents.cc:89
path.h
impeller::SolidColorContents::IsOpaque
bool IsOpaque() const override
Whether this Contents only emits opaque source colors from the fragment stage. This value does not ac...
Definition: solid_color_contents.cc:31
contents.h
impeller::Color
Definition: color.h:122
impeller::SolidColorContents::IsSolidColor
bool IsSolidColor() const override
Definition: solid_color_contents.cc:27
impeller::SolidColorContents::GetCoverage
std::optional< Rect > GetCoverage(const Entity &entity) const override
Get the screen space bounding rectangle that this contents affects.
Definition: solid_color_contents.cc:35
impeller::SolidColorContents::~SolidColorContents
~SolidColorContents() override
impeller::Entity
Definition: entity.h:21
impeller::TSize< int64_t >
color_source_contents.h
impeller::SolidColorContents::ApplyColorFilter
bool ApplyColorFilter(const ColorFilterProc &color_filter_proc) override
If possible, applies a color filter to this contents inputs on the CPU.
Definition: solid_color_contents.cc:106
impeller::Path
Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments....
Definition: path.h:54
impeller::Contents::ColorFilterProc
std::function< Color(Color)> ColorFilterProc
Definition: contents.h:37
impeller::SolidColorContents
Definition: solid_color_contents.h:24
geometry.h
impeller::SolidColorContents::SolidColorContents
SolidColorContents()
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:27
impeller::SolidColorContents::SetColor
void SetColor(Color color)
Definition: solid_color_contents.cc:19
color.h
impeller::SolidColorContents::Render
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: solid_color_contents.cc:48
impeller::ColorSourceContents
Definition: color_source_contents.h:33
impeller
Definition: aiks_context.cc:10
impeller::ContentContext
Definition: content_context.h:344
impeller::SolidColorContents::AsBackgroundColor
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 ...
Definition: solid_color_contents.cc:97