| Flutter Impeller |

stroke_parameters.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_GEOMETRY_STROKE_PARAMETERS_H_
6 #define FLUTTER_IMPELLER_GEOMETRY_STROKE_PARAMETERS_H_
7
8 #include "flutter/impeller/geometry/scalar.h"
9
10 namespace impeller {
11
12 /// @brief An enum that describes ways to decorate the end of a path contour.
13 enum class Cap {
14 kButt,
15 kRound,
16 kSquare,
17 };
18
19 /// @brief An enum that describes ways to join two segments of a path.
20 enum class Join {
21 kMiter,
22 kRound,
23 kBevel,
24 };
25
26 /// @brief A structure to store all of the parameters related to stroking
27 /// a path or basic geometry object.
28 struct StrokeParameters {
29 Scalar width = 0.0f;
30 Cap cap = Cap::kButt;
31 Join join = Join::kMiter;
32 Scalar miter_limit = 4.0f;
33
34 constexpr bool operator==(const StrokeParameters& parameters) const {
35 return parameters.width == width && parameters.cap == cap &&
36 parameters.join == join && parameters.miter_limit == miter_limit;
37 }
38
39 constexpr bool operator!=(const StrokeParameters& parameters) const {
40 return !(*this == parameters);
41 }
42 };
43
44 } // namespace impeller
45
46 #endif // FLUTTER_IMPELLER_GEOMETRY_STROKE_PARAMETERS_H_
impeller
Definition: allocation.cc:12
impeller::Join
Join
An enum that describes ways to join two segments of a path.
Definition: stroke_parameters.h:20
impeller::Join::kRound
@ kRound
impeller::Join::kMiter
@ kMiter
impeller::Join::kBevel
@ kBevel
impeller::Scalar
float Scalar
Definition: scalar.h:19
impeller::Cap
Cap
An enum that describes ways to decorate the end of a path contour.
Definition: stroke_parameters.h:13
impeller::Cap::kRound
@ kRound
impeller::Cap::kButt
@ kButt
impeller::Cap::kSquare
@ kSquare
scalar.h
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::StrokeParameters::cap
Cap cap
Definition: stroke_parameters.h:30
impeller::StrokeParameters::operator!=
constexpr bool operator!=(const StrokeParameters &parameters) const
Definition: stroke_parameters.h:39
impeller::StrokeParameters::join
Join join
Definition: stroke_parameters.h:31
impeller::StrokeParameters::miter_limit
Scalar miter_limit
Definition: stroke_parameters.h:32
impeller::StrokeParameters::operator==
constexpr bool operator==(const StrokeParameters &parameters) const
Definition: stroke_parameters.h:34
impeller::StrokeParameters::width
Scalar width
Definition: stroke_parameters.h:29