| Flutter Impeller |

circle_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_CIRCLE_GEOMETRY_H_
6 #define FLUTTER_IMPELLER_ENTITY_GEOMETRY_CIRCLE_GEOMETRY_H_
7
8 #include "impeller/entity/geometry/geometry.h"
9
10 namespace impeller {
11
12 // Geometry class that can generate vertices (with or without texture
13 // coordinates) for either filled or stroked circles
14 class CircleGeometry final : public Geometry {
15 public:
16 explicit CircleGeometry(const Point& center, Scalar radius);
17
18 explicit CircleGeometry(const Point& center,
19 Scalar radius,
20 Scalar stroke_width);
21
22 ~CircleGeometry() override;
23
24 // |Geometry|
25 bool CoversArea(const Matrix& transform, const Rect& rect) const override;
26
27 // |Geometry|
28 bool IsAxisAlignedRect() const override;
29
30 // |Geometry|
31 Scalar ComputeAlphaCoverage(const Matrix& transform) 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 Point center_;
43 Scalar radius_;
44 Scalar stroke_width_;
45
46 CircleGeometry(const CircleGeometry&) = delete;
47
48 CircleGeometry& operator=(const CircleGeometry&) = delete;
49 };
50
51 } // namespace impeller
52
53 #endif // FLUTTER_IMPELLER_ENTITY_GEOMETRY_CIRCLE_GEOMETRY_H_
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::CircleGeometry::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: circle_geometry.cc:75
geometry.h
impeller::CircleGeometry::ComputeAlphaCoverage
Scalar ComputeAlphaCoverage(const Matrix &transform) const override
Definition: circle_geometry.cc:33
impeller::CircleGeometry::~CircleGeometry
~CircleGeometry() override
stroke_width
const Scalar stroke_width
Definition: stroke_path_geometry.cc:297
impeller::Entity
Definition: entity.h:20
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:213
impeller::GeometryResult
Definition: geometry.h:26
impeller::CircleGeometry::IsAxisAlignedRect
bool IsAxisAlignedRect() const override
Definition: circle_geometry.cc:80
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:33
impeller::Geometry
Definition: geometry.h:55
impeller::TPoint< Scalar >
impeller::CircleGeometry::CircleGeometry
CircleGeometry(const Point &center, Scalar radius)
Definition: circle_geometry.cc:15
impeller
Definition: allocation.cc:12
impeller::CircleGeometry
Definition: circle_geometry.h:14
impeller::ContentContext
Definition: content_context.h:366
impeller::TRect< Scalar >
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37