Flutter Impeller
ellipse_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_ELLIPSE_GEOMETRY_H_
6 #define FLUTTER_IMPELLER_ENTITY_GEOMETRY_ELLIPSE_GEOMETRY_H_
7 
10 
11 namespace impeller {
12 
13 /// @brief A Geometry class that can directly generate vertices (with or
14 /// without texture coordinates) for filled ellipses.
15 ///
16 /// Generating vertices for a stroked ellipse would require a lot more work
17 /// since the line width must be applied perpendicular to the distorted
18 /// ellipse shape.
19 ///
20 /// @see |StrokeEllipseGeometry|
21 class EllipseGeometry final : public Geometry {
22  public:
23  explicit EllipseGeometry(Rect bounds);
24 
25  ~EllipseGeometry() override = default;
26 
27  // |Geometry|
28  bool CoversArea(const Matrix& transform, const Rect& rect) const override;
29 
30  // |Geometry|
31  bool IsAxisAlignedRect() const override;
32 
33  private:
34  // |Geometry|
35  GeometryResult GetPositionBuffer(const ContentContext& renderer,
36  const Entity& entity,
37  RenderPass& pass) const override;
38 
39  // |Geometry|
40  std::optional<Rect> GetCoverage(const Matrix& transform) const override;
41 
42  Rect bounds_;
43 
44  EllipseGeometry(const EllipseGeometry&) = delete;
45 
46  EllipseGeometry& operator=(const EllipseGeometry&) = delete;
47 };
48 
49 /// @brief A Geometry class that produces fillable vertices representing
50 /// the stroked outline of an ellipse with the given bounds.
51 ///
52 /// This class uses the |StrokePathSourceGeometry| base class to do the work
53 /// by providing an |EllipsePathSoure| iterator.
55  public:
56  StrokeEllipseGeometry(const Rect& rect, const StrokeParameters& parameters);
57 
58  protected:
59  // |StrokePathSourceGeometry|
60  const PathSource& GetSource() const override;
61 
62  private:
63  const EllipsePathSource ellipse_source_;
64 };
65 
66 } // namespace impeller
67 
68 #endif // FLUTTER_IMPELLER_ENTITY_GEOMETRY_ELLIPSE_GEOMETRY_H_
A Geometry class that can directly generate vertices (with or without texture coordinates) for filled...
~EllipseGeometry() override=default
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...
bool IsAxisAlignedRect() const override
A PathSource object that provides path iteration for any ellipse inscribed within a Rect bounds.
Definition: path_source.h:90
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
A Geometry class that produces fillable vertices representing the stroked outline of an ellipse with ...
const PathSource & GetSource() const override
StrokeEllipseGeometry(const Rect &rect, const StrokeParameters &parameters)
An abstract Geometry base class that produces fillable vertices representing the stroked outline from...
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.