|
CeresEngine 0.2.0
A game development framework
|
A path that consists of straight and curved line segments that you can render. More...
#include <CeresEngine/Graphics/BezierPath.hpp>
Classes | |
| struct | Element |
A structure that describes a BezierPath element. More... | |
| struct | SubPath |
A structure that describes a BezierPath sub-path. More... | |
Public Types | |
| enum class | WindingRule : UInt8 { NonZero , EvenOdd } |
| Constants that specify the winding rule a Bézier path uses. More... | |
| enum class | ElementType : UInt8 { MoveTo , LineTo , CurveTo , ClosePath } |
| Constants that specify basic path element commands. More... | |
| using | ElementIterator = typename Deque< Element, AnyAllocator >::const_iterator |
| An iterator type that allows iterating over the bezier path elements. | |
| using | ElementReverseIterator = typename Deque< Element, AnyAllocator >::const_reverse_iterator |
| An iterator type that allows iterating over the bezier path elements in reverse order. | |
| using | allocator_type = AnyStdAllocator< BezierPath > |
Public Member Functions | |
| BezierPath () | |
| Creates a new empty bezier path using a default allocator. | |
| BezierPath (AnyAllocatorReference allocator) | |
| Creates a new empty bezier path using a custom allocator. | |
| BezierPath (const BezierPath &)=default | |
| BezierPath & | operator= (const BezierPath &)=default |
| BezierPath (const BezierPath &, AnyAllocatorReference allocator) | |
| BezierPath (BezierPath &&) noexcept=default | |
| BezierPath & | operator= (BezierPath &&) noexcept=default |
| ~BezierPath ()=default | |
| template<typename Allocator > | |
| BezierPath (std::allocator_arg_t, const Allocator &allocator) | |
| Creates a new empty bezier path using a custom allocator. | |
| template<typename Allocator > | |
| BezierPath (std::allocator_arg_t, const Allocator &allocator, const BezierPath &other) | |
| void | move (const Point2 &aPoint) |
| Moves the path's current point to the specified location. | |
| void | move (double x, double y) |
| Moves the path's current point to the specified location. | |
| void | line (const Point2 &aPoint) |
| Appends a straight line to the path. | |
| void | line (double x, double y) |
| Appends a straight line to the path. | |
| void | curve (const Point2 &aPoint, const Point2 &controlPoint1, const Point2 &controlPoint2) |
| Adds a Bezier cubic curve to the path. | |
| void | curve (double x, double y, double c1x, double c1y, double c2x, double c2y) |
| Adds a Bezier cubic curve to the path. | |
| void | close () |
| Closes the most recently added subpath. | |
| void | relativeMove (const Point2 &aPoint) |
| Moves the path's current point to a new point whose location is the specified distance from the current point. | |
| void | relativeLine (const Point2 &aPoint) |
| Appends a straight line segment to the path starting at the current point and moving towards the specified point, relative to the current location. | |
| void | relativeCurve (const Point2 &aPoint, const Point2 &controlPoint1, const Point2 &controlPoint2) |
| Adds a Bezier cubic curve to the path from the current point to a new location, which is specified as a relative distance from the current point. | |
| void | append (const BezierPath &aPath) |
| Appends the contents of the specified path object to the path. | |
| BezierPath & | operator+= (const BezierPath &aPath) |
| Appends the contents of the specified path object to the path. | |
| BezierPath | operator+ (const BezierPath &aPath) const |
| Appends the contents of the specified path object to the path. | |
| void | appendOval (const Rect2 &aRect) |
| Appends an oval path to the path, inscribing the oval in the specified rectangle. | |
| void | appendRect (const Rect2 &aRect) |
| Appends a rectangular path to the path. | |
| void | appendRoundedRect (const Rect2 &aRect, double xRadius, double yRadius) |
| Appends a rounded rectangular path to the path. | |
| void | appendArc (const Point2 &fromPoint, const Point2 &toPoint, double radius) |
| Appends an arc to the path. | |
| void | appendArc (const Point2 ¢er, double radius, const Degree &startAngle, const Degree &endAngle, bool clockwise=false) |
| Appends an arc of a circle to the path. | |
| void | transform (const AffineTransform &aTransform) |
| Transforms all points in the path using the specified transform. | |
| BezierPath | transformed (const AffineTransform &aTransform) const |
| Transforms all points in the path using the specified transform. | |
| bool | contains (const Point2 &aPoint) const |
| Returns a Boolean value that indicates whether the path contains the specified point. | |
| bool | operator& (const Point2 &aPoint) const |
| Returns a Boolean value that indicates whether the path contains the specified point. | |
| void | flatten () |
| Computes a flattened version of the path object. | |
| BezierPath | flattened () const |
| Computes a flattened version of the path object. | |
| void | reverse () |
| Computes a path containing the reversed contents of the current path object. | |
| BezierPath | reversed () const |
| Computes a path containing the reversed contents of the current path object. | |
| BezierPath | expandedStrokeAsFan (const double innerWidth, const double outerWidth) const |
| Creates a new bezier path containing the expanded stroke. | |
| BezierPath | expandedStrokeAsStrip (const double width) const |
| Creates a new bezier path containing the expanded stroke. | |
| BezierPath | expandedStroke (const double innerWidth, const double outerWidth) const |
| Creates a new bezier path containing the expanded stroke. | |
| BezierPath | expandedStroke (const double width) const |
| Creates a new bezier path containing the expanded stroke. | |
| Rect2 | getBounds () const |
| The bounding box of the path. | |
| Rect2 | getControlPointBounds () const |
| The bounding box of the path, including any control points. | |
| Rect2 | getBoundsAccurate () const |
| The bounding box of the path. | |
| Point2 | getCurrentPoint () const |
| The current point (the trailing point or ending point in the most recently added segment). | |
| bool | isEmpty () const |
| A Boolean value that indicates whether the path is empty. | |
| bool | isOpen () const |
| A Boolean value that indicates whether the path is currently open. | |
| bool | isFlat () const |
| A Boolean value that indicates whether the path is flat. | |
| UInt32 | getElementCount () const |
| The total number of path elements in the path. | |
| const Element & | getElement (UInt32 index) const |
| Returns the type of path element at the specified index. | |
| ElementType | getElement (UInt32 index, Point2 &aPoint0, Point2 &aPoint1, Point2 &aPoint2) const |
| Gets the element type and the associated points for the path element at the specified index. | |
| const Element & | operator[] (const UInt32 index) const |
| void | removeAllPoints () |
| Removes all path elements from the path, effectively clearing the path. | |
| void | clear () |
| Removes all path elements from the path, effectively clearing the path. | |
| ElementIterator | cbegin () const |
| Returns an iterator that points to the first path element. | |
| ElementIterator | begin () const |
| Returns an iterator that points to the first path element. | |
| ElementIterator | cend () const |
| Returns an iterator that points to past-the-last path element. | |
| ElementIterator | end () const |
| Returns an iterator that points to past-the-last path element. | |
| ElementReverseIterator | crbegin () const |
| Returns an iterator that points to the first path element in the reversed order. | |
| ElementReverseIterator | rbegin () const |
| Returns an iterator that points to the first path element in the reversed order. | |
| ElementReverseIterator | crend () const |
| Returns an iterator that points to past-the-last path element in the reversed order. | |
| ElementReverseIterator | rend () const |
| Returns an iterator that points to past-the-last path element in the reversed order. | |
| Vector< SubPath > | getSubPaths () const |
| Gets a vector that contains all sub-paths currently on the bezier path. | |
| WindingRule | getWindingRule () const |
| The winding rule used to fill the path. | |
| void | setWindingRule (WindingRule windingRule) |
| The winding rule used to fill the path. | |
| double | getFlatness () const |
| The accuracy with which curves are rendered. | |
| void | setFlatness (double flatness) |
| The accuracy with which curves are rendered. | |
| String | toSVG () const |
| AnyAllocatorReference | getAllocator () const noexcept |
Static Public Member Functions | |
| static BezierPath | oval (const Rect2 &aRect) |
| Creates an oval path, inscribing the oval in the specified rectangle. | |
| static BezierPath | oval (AnyAllocatorReference allocator, const Rect2 &aRect) |
| Creates an oval path, inscribing the oval in the specified rectangle. | |
| static BezierPath | rect (const Rect2 &aRect) |
| Creates a rectangular path. | |
| static BezierPath | rect (AnyAllocatorReference allocator, const Rect2 &aRect) |
| \coypdoc rect(const Rect2&) | |
| static BezierPath | roundedRect (const Rect2 &aRect, const double xRadius, const double yRadius) |
| Creates a rounded rectangular path. | |
| static BezierPath | roundedRect (AnyAllocatorReference allocator, const Rect2 &aRect, double xRadius, double yRadius) |
| Creates a rounded rectangular path. | |
| static BezierPath | arc (const Point2 &fromPoint, const Point2 &toPoint, const double radius) |
| Creates an arc path. | |
| static BezierPath | arc (AnyAllocatorReference allocator, const Point2 &fromPoint, const Point2 &toPoint, double radius) |
| Creates an arc path. | |
| static BezierPath | arc (const Point2 ¢er, const double radius, const Degree &startAngle, const Degree &endAngle, const bool clockwise=false) |
| Creates an arc of a circle. | |
| static BezierPath | arc (AnyAllocatorReference allocator, const Point2 ¢er, double radius, const Degree &startAngle, const Degree &endAngle, bool clockwise=false) |
| Creates an arc of a circle. | |
Private Member Functions | |
| BezierPath | expandedStrokeInternal (double innerWidth, double outerWidth, bool asTriangleFan) const |
| Creates a new bezier path containing the expanded stroke. | |
Private Attributes | |
| WindingRule | mWindingRule = WindingRule::NonZero |
| The winding rule used to fill the path. | |
| double | mFlatness = 0.6 |
| The accuracy with which curves are rendered. | |
| Deque< Element, AnyAllocator > | mElements {gDefaultAllocator()} |
An array of BezierPath elements. | |
Friends | |
| bool | operator== (const BezierPath &lhs, const BezierPath &rhs) noexcept |
| bool | operator!= (const BezierPath &lhs, const BezierPath &rhs) noexcept |
A path that consists of straight and curved line segments that you can render.
Paths consist of straight and curved line segments joined together. Paths can form recognizable shapes such as rectangles, ovals and arcs; they can also form complex polygons using either straight or line segments. A single path can be closed by connecting its two endpoints, or it can be left open.
An BezierPath object can contain multiple disconnected paths, whether they are closed or open. Each of these paths is referred to as a subpath. The subpaths of a Bézier path object must be manipulated as a group. The only way to manipulate subpaths individually is to create separate BezierPath objects for each.
Using methods of BezierPath, you can also perform hit detection on the filled or stroked path. Hit detection is needed to implement interactive graphics, as in rubber banding and dragging operations.
| using CeresEngine::BezierPath::ElementIterator = typename Deque<Element, AnyAllocator>::const_iterator |
An iterator type that allows iterating over the bezier path elements.
| using CeresEngine::BezierPath::ElementReverseIterator = typename Deque<Element, AnyAllocator>::const_reverse_iterator |
An iterator type that allows iterating over the bezier path elements in reverse order.
Constants that specify basic path element commands.
These commands are enough to define all of the possible path shapes. Each command has one or more points that contain information needed to position the path element. Most path elements use the current drawing point as the starting point for drawing.
|
explicit |
Creates a new empty bezier path using a default allocator.
|
explicit |
Creates a new empty bezier path using a custom allocator.
| allocator | The allocator to be used for memory allocations. |
|
default |
| CeresEngine::BezierPath::BezierPath | ( | const BezierPath & | , |
| AnyAllocatorReference | allocator | ||
| ) |
|
defaultnoexcept |
|
default |
|
inlineexplicit |
Creates a new empty bezier path using a custom allocator.
| allocator | The allocator to be used for memory allocations. |
|
inlineexplicit |
| void CeresEngine::BezierPath::append | ( | const BezierPath & | aPath | ) |
Appends the contents of the specified path object to the path.
This method adds the commands used to create aPath to the end of the receiver's path. This method does not explicitly try to connect the subpaths in the two objects, although the operations in aPath may still cause that effect.
| aPath | The path to add to the receiver. |
| void CeresEngine::BezierPath::appendArc | ( | const Point2 & | center, |
| double | radius, | ||
| const Degree & | startAngle, | ||
| const Degree & | endAngle, | ||
| bool | clockwise = false |
||
| ) |
Appends an arc of a circle to the path.
The created arc lies on the perimeter of the circle, between the angles specified by the startAngle and endAngle parameters. The arc is drawn in the direction indicated by the clockwise parameter. If the receiver's path is empty, this method sets the current point to the beginning of the arc before adding the arc segment. If the receiver's path is not empty, a line is drawn from the current point to the starting point of the arc.
Depending on the length of the arc, this method may add multiple connected curve segments to the path.
| center | Specifies the center point of the circle used to define the arc. |
| radius | Specifies the radius of the circle used to define the arc. |
| startAngle | Specifies the starting angle of the arc, measured in degrees counterclockwise from the x-axis. |
| endAngle | Specifies the end angle of the arc, measured in degrees counterclockwise from the x-axis. |
| clockwise | true if you want the arc to be drawn in a clockwise direction; otherwise false to draw the arc in a counterclockwise direction. |
| void CeresEngine::BezierPath::appendArc | ( | const Point2 & | fromPoint, |
| const Point2 & | toPoint, | ||
| double | radius | ||
| ) |
Appends an arc to the path.
The created arc is defined by a circle inscribed inside the angle specified by three points: the current point, the fromPoint parameter, and the toPoint parameter (in that order). The arc itself lies on the perimeter of the circle, whose radius is specified by the radius parameter. The arc is drawn between the two points of the circle that are tangent to the two legs of the angle.
The arc usually does not contain the points in the fromPoint and toPoint parameters. If the starting point of the arc does not coincide with the current point, a line is drawn between the two points. The starting point of the arc lies on the line defined by the current point and the fromPoint parameter.
You must set the path's current point (using the move method or through the creation of a preceding line or curve segment) before you invoke this method. If the path is empty, this method throws.
Depending on the length of the arc, this method may add multiple connected curve segments to the path.
| fromPoint | The middle point of the angle. |
| toPoint | The end point of the angle. |
| radius | The radius of the circle inscribed in the angle. |
Appends an oval path to the path, inscribing the oval in the specified rectangle.
Before adding the oval, this method moves the current point, which implicitly closes the current subpath. If the aRect parameter specifies a square, the inscribed path is a circle. The path is constructed by starting in the lower-right quadrant of the rectangle and adding arc segments counterclockwise to complete the oval.
| aRect | The rectangle in which to inscribe the oval. |
Appends a rectangular path to the path.
Before adding the rectangle, this method moves the current point to the origin of the rectangle, which implicitly closes the current subpath (if any). The path is constructed by starting at the origin of aRect and adding line segments in a counterclockwise direction. The final segment is added using close.
| aRect | The rectangle describing the path to create. |
| void CeresEngine::BezierPath::appendRoundedRect | ( | const Rect2 & | aRect, |
| double | xRadius, | ||
| double | yRadius | ||
| ) |
Appends a rounded rectangular path to the path.
The path is constructed in a counter-clockwise direction, starting at the top-left corner of the rectangle. If either one of the radius parameters contains the value 0.0, the returned path is a plain rectangle without rounded corners.
| aRect | The rectangle that defines the basic shape of the path. |
| xRadius | The radius of each corner oval along the x-axis. Values larger than half the rectangle's width are clamped to half the width. |
| yRadius | The radius of each corner oval along the y-axis. Values larger than half the rectangle's height are clamped to half the height. |
|
static |
Creates an arc of a circle.
The created arc lies on the perimeter of the circle, between the angles specified by the startAngle and endAngle parameters. The arc is drawn in the direction indicated by the clockwise parameter.
Depending on the length of the arc, this method may add multiple connected curve segments to the path.
| center | Specifies the center point of the circle used to define the arc. |
| radius | Specifies the radius of the circle used to define the arc. |
| startAngle | Specifies the starting angle of the arc, measured in degrees counterclockwise from the x-axis. |
| endAngle | Specifies the end angle of the arc, measured in degrees counterclockwise from the x-axis. |
| clockwise | true if you want the arc to be drawn in a clockwise direction; otherwise false to draw the arc in a counterclockwise direction. |
|
static |
Creates an arc path.
The created arc is defined by a circle inscribed inside the angle specified by three points: the current point, the fromPoint parameter, and the toPoint parameter (in that order). The arc itself lies on the perimeter of the circle, whose radius is specified by the radius parameter. The arc is drawn between the two points of the circle that are tangent to the two legs of the angle.
The arc usually does not contain the points in the fromPoint and toPoint parameters. If the starting point of the arc does not coincide with the current point, a line is drawn between the two points. The starting point of the arc lies on the line defined by the current point and the fromPoint parameter.
Depending on the length of the arc, this method may add multiple connected curve segments to the path.
| fromPoint | The middle point of the angle. |
| toPoint | The end point of the angle. |
| radius | The radius of the circle inscribed in the angle. |
|
inlinestatic |
Creates an arc of a circle.
The created arc lies on the perimeter of the circle, between the angles specified by the startAngle and endAngle parameters. The arc is drawn in the direction indicated by the clockwise parameter.
Depending on the length of the arc, this method may add multiple connected curve segments to the path.
| center | Specifies the center point of the circle used to define the arc. |
| radius | Specifies the radius of the circle used to define the arc. |
| startAngle | Specifies the starting angle of the arc, measured in degrees counterclockwise from the x-axis. |
| endAngle | Specifies the end angle of the arc, measured in degrees counterclockwise from the x-axis. |
| clockwise | true if you want the arc to be drawn in a clockwise direction; otherwise false to draw the arc in a counterclockwise direction. |
|
inlinestatic |
Creates an arc path.
The created arc is defined by a circle inscribed inside the angle specified by three points: the current point, the fromPoint parameter, and the toPoint parameter (in that order). The arc itself lies on the perimeter of the circle, whose radius is specified by the radius parameter. The arc is drawn between the two points of the circle that are tangent to the two legs of the angle.
The arc usually does not contain the points in the fromPoint and toPoint parameters. If the starting point of the arc does not coincide with the current point, a line is drawn between the two points. The starting point of the arc lies on the line defined by the current point and the fromPoint parameter.
Depending on the length of the arc, this method may add multiple connected curve segments to the path.
| fromPoint | The middle point of the angle. |
| toPoint | The end point of the angle. |
| radius | The radius of the circle inscribed in the angle. |
|
inline |
Returns an iterator that points to the first path element.
|
inline |
Returns an iterator that points to the first path element.
|
inline |
Returns an iterator that points to past-the-last path element.
|
inline |
Removes all path elements from the path, effectively clearing the path.
| void CeresEngine::BezierPath::close | ( | ) |
Closes the most recently added subpath.
This method closes the current subpath by creating a line segment between the first and last points in the subpath. This method subsequently updates the current point to the end of the newly created line segment, which is also the first point in the now closed subpath.
Returns a Boolean value that indicates whether the path contains the specified point.
This method checks the point against the path itself and the area it encloses. When determining hits in the enclosed area, this method uses the non-zero winding rule (nonZero). It does not take into account the line width used to stroke the path.
| aPoint | The point to test against the path, specified in the path object's coordinate system. |
true if the path's enclosed area contains the specified point; otherwise, false.
|
inline |
Returns an iterator that points to the first path element in the reversed order.
|
inline |
Returns an iterator that points to past-the-last path element in the reversed order.
| void CeresEngine::BezierPath::curve | ( | const Point2 & | aPoint, |
| const Point2 & | controlPoint1, | ||
| const Point2 & | controlPoint2 | ||
| ) |
Adds a Bezier cubic curve to the path.
| aPoint | The destination point of the curve segment, specified in the current coordinate system. |
| controlPoint1 | The point that determines the shape of the curve near the current point. |
| controlPoint2 | The point that determines the shape of the curve near the destination point. |
|
inline |
Adds a Bezier cubic curve to the path.
| aPoint | The destination point of the curve segment, specified in the current coordinate system. |
| controlPoint1 | The point that determines the shape of the curve near the current point. |
| controlPoint2 | The point that determines the shape of the curve near the destination point. |
|
inline |
Returns an iterator that points to past-the-last path element.
|
inline |
Creates a new bezier path containing the expanded stroke.
|
inline |
Creates a new bezier path containing the expanded stroke.
|
inline |
Creates a new bezier path containing the expanded stroke.
|
inline |
Creates a new bezier path containing the expanded stroke.
|
private |
Creates a new bezier path containing the expanded stroke.
| void CeresEngine::BezierPath::flatten | ( | ) |
Computes a flattened version of the path object.
Flattening a path converts all curved line segments into straight line approximations. The granularity of the approximations is controlled by the path's current flatness value, which is set using the setFlatness method.
| BezierPath CeresEngine::BezierPath::flattened | ( | ) | const |
Computes a flattened version of the path object.
Flattening a path converts all curved line segments into straight line approximations. The granularity of the approximations is controlled by the path's current flatness value, which is set using the setFlatness method.
|
inlinenoexcept |
| Rect2 CeresEngine::BezierPath::getBounds | ( | ) | const |
The bounding box of the path.
This property contains the rectangle that encloses the path of the receiver. If the path contains curve segments, the bounding box encloses the curve but may not enclose the control points used to calculate the curve.
If the path is empty, this method returns an empty rect.
| Rect2 CeresEngine::BezierPath::getBoundsAccurate | ( | ) | const |
The bounding box of the path.
This property contains the rectangle that encloses the path of the receiver. This method performs a more accurate bounding box calculation by flattening the path. This is a slow operation, so only use it when you actually need a precise bounding box.
If the path is empty, this method returns an empty rect.
| Rect2 CeresEngine::BezierPath::getControlPointBounds | ( | ) | const |
The bounding box of the path, including any control points.
This property contains the rectangle that encloses the receiver's path. If the path contains curve segments, the bounding box encloses the control points of the curves as well as the curves themselves.
| Point2 CeresEngine::BezierPath::getCurrentPoint | ( | ) | const |
The current point (the trailing point or ending point in the most recently added segment).
If the path is empty, accessing this property returns a zero point.
Returns the type of path element at the specified index.
Path elements describe the commands used to define a path and include basic commands such as moving to a specific point, creating a line segment, creating a curve, or closing the path. The elements are stored in the order of their execution.
| index | The index of the desired path element. |
Element structure. | ElementType CeresEngine::BezierPath::getElement | ( | UInt32 | index, |
| Point2 & | aPoint0, | ||
| Point2 & | aPoint1, | ||
| Point2 & | aPoint2 | ||
| ) | const |
Gets the element type and the associated points for the path element at the specified index.
Move, close path, and line segment commands return one point. Curve operations return three points. For curve operations, the order of the points is controlPoint1 (aPoint0), controlPoint2 (aPoint1), endPoint (aPoint2).
| index | The index of the desired path element. |
| aPoint0 | The first associated point for the element. |
| aPoint1 | The second associated point for the element. |
| aPoint2 | The third associated point for the element. |
ElementType. | UInt32 CeresEngine::BezierPath::getElementCount | ( | ) | const |
The total number of path elements in the path.
Each element type corresponds to one of the operations described in ElementType.
|
inline |
The accuracy with which curves are rendered.
The flatness value specifies the accuracy (or smoothness) with which curves are rendered. It is also the maximum error tolerance (measured in pixels) for rendering curves, where smaller numbers give smoother curves at the expense of more computation. The exact interpretation may vary slightly on different rendering devices.
Gets a vector that contains all sub-paths currently on the bezier path.
|
inline |
The winding rule used to fill the path.
| bool CeresEngine::BezierPath::isEmpty | ( | ) | const |
A Boolean value that indicates whether the path is empty.
The value of this property is true if the path contains no elements, or false if it contains at least one element.
| bool CeresEngine::BezierPath::isFlat | ( | ) | const |
A Boolean value that indicates whether the path is flat.
The value of this property is true if the path contains only move, lineTo and close elements, or false if it contains at least one of any other type of element.
| bool CeresEngine::BezierPath::isOpen | ( | ) | const |
A Boolean value that indicates whether the path is currently open.
The value of this property is true if the path is currently open, or false if it's last element is a close path element.
Appends a straight line to the path.
This method creates a straight line segment starting at the current point and ending at the point specified by the aPoint parameter. The current point is the last point in the receiver's most recently added segment.
You must set the path's current point (using the move() method or through the creation of a preceding line or curve segment) before you invoke this method. If the path is empty, this method throws.
| aPoint | The destination point of the line segment, specified in the current coordinate system. |
Appends a straight line to the path.
This method creates a straight line segment starting at the current point and ending at the point specified by the aPoint parameter. The current point is the last point in the receiver's most recently added segment.
You must set the path's current point (using the move() method or through the creation of a preceding line or curve segment) before you invoke this method. If the path is empty, this method throws.
| aPoint | The destination point of the line segment, specified in the current coordinate system. |
Moves the path's current point to the specified location.
This method implicitly closes the current subpath (if any) and sets the current point to the value in aPoint. When closing the previous subpath, this method does not cause a line to be created from the first and last points in the subpath.
For many path operations, you must invoke this method before issuing any commands that cause a line or curve segment to be drawn.
| aPoint | A point in the current coordinate system. |
Moves the path's current point to the specified location.
This method implicitly closes the current subpath (if any) and sets the current point to the value in aPoint. When closing the previous subpath, this method does not cause a line to be created from the first and last points in the subpath.
For many path operations, you must invoke this method before issuing any commands that cause a line or curve segment to be drawn.
| aPoint | A point in the current coordinate system. |
Returns a Boolean value that indicates whether the path contains the specified point.
This method checks the point against the path itself and the area it encloses. When determining hits in the enclosed area, this method uses the non-zero winding rule (nonZero). It does not take into account the line width used to stroke the path.
| aPoint | The point to test against the path, specified in the path object's coordinate system. |
true if the path's enclosed area contains the specified point; otherwise, false.
|
inline |
Appends the contents of the specified path object to the path.
This method adds the commands used to create aPath to the end of the receiver's path. This method does not explicitly try to connect the subpaths in the two objects, although the operations in aPath may still cause that effect.
| aPath | The path to add to the receiver. |
|
inline |
Appends the contents of the specified path object to the path.
This method adds the commands used to create aPath to the end of the receiver's path. This method does not explicitly try to connect the subpaths in the two objects, although the operations in aPath may still cause that effect.
| aPath | The path to add to the receiver. |
|
defaultnoexcept |
|
default |
|
static |
Creates an oval path, inscribing the oval in the specified rectangle.
The path is constructed by starting in the lower-right quadrant of the rectangle and adding arc segments counterclockwise to complete the oval.
| aRect | The rectangle in which to inscribe the oval. |
|
inlinestatic |
Creates an oval path, inscribing the oval in the specified rectangle.
The path is constructed by starting in the lower-right quadrant of the rectangle and adding arc segments counterclockwise to complete the oval.
| aRect | The rectangle in which to inscribe the oval. |
|
inline |
Returns an iterator that points to the first path element in the reversed order.
|
static |
\coypdoc rect(const Rect2&)
|
inlinestatic |
Creates a rectangular path.
The path is constructed by starting at the origin of aRect and adding line segments in a counterclockwise direction. The final segment is added using close.
| aRect | The rectangle describing the path to create. |
| void CeresEngine::BezierPath::relativeCurve | ( | const Point2 & | aPoint, |
| const Point2 & | controlPoint1, | ||
| const Point2 & | controlPoint2 | ||
| ) |
Adds a Bezier cubic curve to the path from the current point to a new location, which is specified as a relative distance from the current point.
You must set the path's current point (using the move() method or through the creation of a preceding line or curve segment) before you invoke this method. If the path is empty, this method throws.
| aPoint | The destination point of the curve segment, interpreted as a relative offset from the current point. |
| controlPoint1 | The point that determines the shape of the curve near the current point, interpreted as a relative offset from the current point. |
| controlPoint2 | The point that determines the shape of the curve near the destination point, interpreted as a relative offset from the current point. |
Appends a straight line segment to the path starting at the current point and moving towards the specified point, relative to the current location.
The destination point is relative to the current point. For example, if the current point is (1, 1) and aPoint contains the value (1, 2), a line segment is created between the points (1, 1) and (2, 3).
You must set the path's current point (using the move() method or through the creation of a preceding line or curve segment) before you invoke this method. If the path is empty, this method throws.
| aPoint | A point whose coordinates are interpreted as a relative offset from the current point. |
Moves the path's current point to a new point whose location is the specified distance from the current point.
This method implicitly closes the current subpath (if any) and updates the location of the current point. For example, if the current point is (1, 1) and aPoint contains the value (1, 2), the previous subpath would be closed and the current point would become (2, 3). When closing the previous subpath, this method does not cause a line to be created from the first and last points in the subpath.
You must set the path's current point (using the move() method or through the creation of a preceding line or curve segment) before you invoke this method. If the path is empty, this method throws.
| aPoint | A point whose coordinates are interpreted as a relative offset from the current point. |
| void CeresEngine::BezierPath::removeAllPoints | ( | ) |
Removes all path elements from the path, effectively clearing the path.
|
inline |
Returns an iterator that points to past-the-last path element in the reversed order.
| void CeresEngine::BezierPath::reverse | ( | ) |
Computes a path containing the reversed contents of the current path object.
The reversed path does not necessarily have a different appearance when rendered. Instead, it changes the direction in which path segments are drawn. For example, reversing the path of a rectangle (whose line segments are normally drawn starting at the origin and proceeding in a counterclockwise direction) causes its line segments to be drawn in a clockwise direction instead. Drawing a reversed path could affect the appearance of a filled pattern, depending on the pattern and the fill rule in use.
The path is created by reversing each whole or partial subpath in the path object individually.
| BezierPath CeresEngine::BezierPath::reversed | ( | ) | const |
Computes a path containing the reversed contents of the current path object.
The reversed path does not necessarily have a different appearance when rendered. Instead, it changes the direction in which path segments are drawn. For example, reversing the path of a rectangle (whose line segments are normally drawn starting at the origin and proceeding in a counterclockwise direction) causes its line segments to be drawn in a clockwise direction instead. Drawing a reversed path could affect the appearance of a filled pattern, depending on the pattern and the fill rule in use.
The path is created by reversing each whole or partial subpath in the path object individually.
|
static |
Creates a rounded rectangular path.
The path is constructed in a counter-clockwise direction, starting at the top-left corner of the rectangle. If either one of the radius parameters contains the value 0.0, the returned path is a plain rectangle without rounded corners.
| aRect | The rectangle that defines the basic shape of the path. |
| xRadius | The radius of each corner oval along the x-axis. Values larger than half the rectangle's width are clamped to half the width. |
| yRadius | The radius of each corner oval along the y-axis. Values larger than half the rectangle's height are clamped to half the height. |
|
inlinestatic |
Creates a rounded rectangular path.
The path is constructed in a counter-clockwise direction, starting at the top-left corner of the rectangle. If either one of the radius parameters contains the value 0.0, the returned path is a plain rectangle without rounded corners.
| aRect | The rectangle that defines the basic shape of the path. |
| xRadius | The radius of each corner oval along the x-axis. Values larger than half the rectangle's width are clamped to half the width. |
| yRadius | The radius of each corner oval along the y-axis. Values larger than half the rectangle's height are clamped to half the height. |
The accuracy with which curves are rendered.
The flatness value specifies the accuracy (or smoothness) with which curves are rendered. It is also the maximum error tolerance (measured in pixels) for rendering curves, where smaller numbers give smoother curves at the expense of more computation. The exact interpretation may vary slightly on different rendering devices.
| void CeresEngine::BezierPath::setWindingRule | ( | WindingRule | windingRule | ) |
The winding rule used to fill the path.
| String CeresEngine::BezierPath::toSVG | ( | ) | const |
Transforms all points in the path using the specified transform.
This method applies the transform to the path's points immediately.
| aTransform | The transform to apply to the path. |
| BezierPath CeresEngine::BezierPath::transformed | ( | const AffineTransform & | aTransform | ) | const |
Transforms all points in the path using the specified transform.
This method applies the transform to the path's points immediately.
| aTransform | The transform to apply to the path. |
|
friend |
|
friend |
|
private |
An array of BezierPath elements.
|
private |
The accuracy with which curves are rendered.
The flatness value specifies the accuracy (or smoothness) with which curves are rendered. It is also the maximum error tolerance (measured in pixels) for rendering curves, where smaller numbers give smoother curves at the expense of more computation. The exact interpretation may vary slightly on different rendering devices.
|
private |
The winding rule used to fill the path.