Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
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
9
10namespace impeller {
11
12// Geometry class that can generate vertices (with or without texture
13// coordinates) for either filled or stroked circles
14class 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 IRect& rect) const override;
26
27 // |Geometry|
28 bool IsAxisAlignedRect() const override;
29
30 // |Geometry|
31 Scalar ComputeAlphaCoverage(const Matrix& transform) const override;
32
33 Scalar GetRadius() const;
34 Scalar GetStrokeWidth() const;
35 Point GetCenter() const;
36
37 // |Geometry|
38 std::optional<Rect> GetCoverage(const Matrix& transform) const override;
39
40 // |Geometry|
42 const Entity& entity,
43 RenderPass& pass) const override;
44
45 // Set the number of pixels to add to the edge(s) of the circle for
46 // SDF-based antialiasing
47 void SetAntialiasPadding(Scalar extra_pixels);
48
50
51 private:
52 Point center_;
53 Scalar radius_;
54 Scalar stroke_width_;
55 Scalar padding_pixels_;
56
57 CircleGeometry(const CircleGeometry&) = delete;
58
59 CircleGeometry& operator=(const CircleGeometry&) = delete;
60};
61
62} // namespace impeller
63
64#endif // FLUTTER_IMPELLER_ENTITY_GEOMETRY_CIRCLE_GEOMETRY_H_
Scalar ComputeAlphaCoverage(const Matrix &transform) const override
Scalar GetAntialiasPadding() const
bool CoversArea(const Matrix &transform, const IRect &rect) const override
Determines if this geometry, transformed by the given transform, will completely cover all of the pix...
GeometryResult GetPositionBuffer(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
bool IsAxisAlignedRect() const override
void SetAntialiasPadding(Scalar extra_pixels)
std::optional< Rect > GetCoverage(const Matrix &transform) const override
The coverage rectangle of this geometry, transformed by the transform argument.
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
A 4x4 matrix using column-major storage.
Definition matrix.h:37