Flutter Impeller
rect_geometry.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_GEOMETRY_RECT_GEOMETRY_H_
6 #define FLUTTER_IMPELLER_ENTITY_GEOMETRY_RECT_GEOMETRY_H_
7 
10 
11 namespace impeller {
12 
13 class FillRectGeometry final : public Geometry {
14  public:
15  explicit FillRectGeometry(Rect rect);
16 
17  ~FillRectGeometry() override;
18 
19  const Rect& GetRect() const;
20 
22 
24 
25  // |Geometry|
26  bool CoversArea(const Matrix& transform, const Rect& rect) const override;
27 
28  // |Geometry|
29  bool IsAxisAlignedRect() const override;
30 
31  // |Geometry|
33  const Entity& entity,
34  RenderPass& pass) const override;
35 
36  // |Geometry|
37  std::optional<Rect> GetCoverage(const Matrix& transform) const override;
38 
39  private:
40  Rect rect_;
41  Scalar padding_pixels_ = 0.0f;
42 };
43 
44 class StrokeRectGeometry final : public Geometry {
45  public:
46  explicit StrokeRectGeometry(const Rect& rect, const StrokeParameters& stroke);
47 
48  ~StrokeRectGeometry() override;
49 
50  // |Geometry|
52  const Entity& entity,
53  RenderPass& pass) const override;
54 
55  // |Geometry|
56  std::optional<Rect> GetCoverage(const Matrix& transform) const override;
57 
58  private:
59  const Rect rect_;
60  const Scalar stroke_width_;
61  const Join stroke_join_;
62 
63  static Join AdjustStrokeJoin(const StrokeParameters& stroke);
64 };
65 
66 } // namespace impeller
67 
68 #endif // FLUTTER_IMPELLER_ENTITY_GEOMETRY_RECT_GEOMETRY_H_
Scalar GetAntialiasPadding() const
void SetAntialiasPadding(Scalar padding)
std::optional< Rect > GetCoverage(const Matrix &transform) const override
bool CoversArea(const Matrix &transform, const Rect &rect) const override
Determines if this geometry, transformed by the given transform, will completely cover all surface ar...
const Rect & GetRect() const
bool IsAxisAlignedRect() const override
GeometryResult GetPositionBuffer(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
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 Matrix &transform) const override
StrokeRectGeometry(const Rect &rect, const StrokeParameters &stroke)
GeometryResult GetPositionBuffer(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Vector2 padding
The halo padding in source space.
Join
An enum that describes ways to join two segments of a path.
float Scalar
Definition: scalar.h:19
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
A structure to store all of the parameters related to stroking a path or basic geometry object.