| 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
8 #include "impeller/entity/geometry/geometry.h"
9 #include "impeller/entity/geometry/stroke_path_geometry.h"
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.
54 class StrokeEllipseGeometry final : public StrokePathSourceGeometry {
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_
impeller::ContentContext
Definition: content_context.h:122
impeller::EllipseGeometry
A Geometry class that can directly generate vertices (with or without texture coordinates) for filled...
Definition: ellipse_geometry.h:21
impeller::EllipseGeometry::EllipseGeometry
EllipseGeometry(Rect bounds)
Definition: ellipse_geometry.cc:13
impeller::EllipseGeometry::~EllipseGeometry
~EllipseGeometry() override=default
impeller::EllipseGeometry::CoversArea
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...
Definition: ellipse_geometry.cc:30
impeller::EllipseGeometry::IsAxisAlignedRect
bool IsAxisAlignedRect() const override
Definition: ellipse_geometry.cc:35
impeller::EllipsePathSource
A PathSource object that provides path iteration for any ellipse inscribed within a Rect bounds.
Definition: path_source.h:90
impeller::Entity
Definition: entity.h:26
impeller::Geometry
Definition: geometry.h:50
impeller::PathSource
Definition: path_source.h:55
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
impeller::StrokeEllipseGeometry
A Geometry class that produces fillable vertices representing the stroked outline of an ellipse with ...
Definition: ellipse_geometry.h:54
impeller::StrokeEllipseGeometry::GetSource
const PathSource & GetSource() const override
Definition: ellipse_geometry.cc:43
impeller::StrokeEllipseGeometry::StrokeEllipseGeometry
StrokeEllipseGeometry(const Rect &rect, const StrokeParameters &parameters)
Definition: ellipse_geometry.cc:39
impeller::StrokePathSourceGeometry
An abstract Geometry base class that produces fillable vertices representing the stroked outline from...
Definition: stroke_path_geometry.h:94
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:312
geometry.h
impeller
Definition: allocation.cc:12
stroke_path_geometry.h
impeller::GeometryResult
Definition: geometry.h:21
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::StrokeParameters
A structure to store all of the parameters related to stroking a path or basic geometry object.
Definition: stroke_parameters.h:28
impeller::TRect< Scalar >