| 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
8 #include "impeller/entity/contents/color_source_contents.h"
9 #include "impeller/entity/contents/contents.h"
10 #include "impeller/geometry/color.h"
11
12 namespace impeller {
13
14 class SolidColorContents final : public ColorSourceContents {
15 public:
16 SolidColorContents();
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 // |Contents|
28 bool IsOpaque(const Matrix& transform) const override;
29
30 // |Contents|
31 std::optional<Rect> GetCoverage(const Entity& entity) const override;
32
33 // |Contents|
34 bool Render(const ContentContext& renderer,
35 const Entity& entity,
36 RenderPass& pass) const override;
37
38 std::optional<Color> AsBackgroundColor(const Entity& entity,
39 ISize target_size) const override;
40
41 // |Contents|
42 [[nodiscard]] bool ApplyColorFilter(
43 const ColorFilterProc& color_filter_proc) override;
44
45 private:
46 Color color_;
47
48 SolidColorContents(const SolidColorContents&) = delete;
49
50 SolidColorContents& operator=(const SolidColorContents&) = delete;
51 };
52
53 } // namespace impeller
54
55 #endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_SOLID_COLOR_CONTENTS_H_
impeller::ColorSourceContents
Definition: color_source_contents.h:38
impeller::ContentContext
Definition: content_context.h:138
impeller::Contents::ColorFilterProc
std::function< Color(Color)> ColorFilterProc
Definition: contents.h:35
impeller::Entity
Definition: entity.h:20
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
impeller::SolidColorContents
Definition: solid_color_contents.h:14
impeller::SolidColorContents::~SolidColorContents
~SolidColorContents() override
impeller::SolidColorContents::IsOpaque
bool IsOpaque(const Matrix &transform) const override
Whether this Contents only emits opaque source colors from the fragment stage. This value does not ac...
Definition: solid_color_contents.cc:30
impeller::SolidColorContents::IsSolidColor
bool IsSolidColor() const override
Definition: solid_color_contents.cc:26
impeller::SolidColorContents::SetColor
void SetColor(Color color)
Definition: solid_color_contents.cc:18
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:81
impeller::SolidColorContents::SolidColorContents
SolidColorContents()
impeller::SolidColorContents::Render
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: solid_color_contents.cc:47
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:72
impeller::SolidColorContents::GetCoverage
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.
Definition: solid_color_contents.cc:34
impeller::SolidColorContents::GetColor
Color GetColor() const
Definition: solid_color_contents.cc:22
color.h
color_source_contents.h
contents.h
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:214
impeller
Definition: allocation.cc:12
impeller::Color
Definition: color.h:124
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::TSize
Definition: size.h:25