Flutter Impeller
arc_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_ARC_GEOMETRY_H_
6 #define FLUTTER_IMPELLER_ENTITY_GEOMETRY_ARC_GEOMETRY_H_
7 
9 
10 #include "impeller/geometry/arc.h"
12 
13 namespace impeller {
14 
15 // Geometry class that can generate vertices (with or without texture
16 // coordinates) for either filled or stroked circles
17 class ArcGeometry final : public Geometry {
18  public:
19  explicit ArcGeometry(const Arc& arc);
20 
21  explicit ArcGeometry(const Arc& arc, const StrokeParameters& stroke);
22 
23  ~ArcGeometry() override;
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|
32  Scalar ComputeAlphaCoverage(const Matrix& transform) const override;
33 
34  private:
35  // |Geometry|
36  GeometryResult GetPositionBuffer(const ContentContext& renderer,
37  const Entity& entity,
38  RenderPass& pass) const override;
39 
40  // |Geometry|
41  std::optional<Rect> GetCoverage(const Matrix& transform) const override;
42 
43  Arc arc_;
44  Scalar stroke_width_;
45  Cap cap_;
46 
47  ArcGeometry(const ArcGeometry&) = delete;
48 
49  ArcGeometry& operator=(const ArcGeometry&) = delete;
50 };
51 
52 } // namespace impeller
53 
54 #endif // FLUTTER_IMPELLER_ENTITY_GEOMETRY_ARC_GEOMETRY_H_
bool IsAxisAlignedRect() const override
Definition: arc_geometry.cc:79
Scalar ComputeAlphaCoverage(const Matrix &transform) const override
Definition: arc_geometry.cc:23
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: arc_geometry.cc:75
ArcGeometry(const Arc &arc)
Definition: arc_geometry.cc:11
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
float Scalar
Definition: scalar.h:19
Cap
An enum that describes ways to decorate the end of a path contour.
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.