|
HikoGUI
A low latency retained GUI
|
#include <TTauri/Foundation/Path.hpp>
Public Member Functions | |
| void | clear () noexcept |
| Clear the path. | |
| ssize_t | numberOfContours () const noexcept |
| ssize_t | numberOfLayers () const noexcept |
| bool | allLayersHaveSameColor () const noexcept |
| aarect | boundingBox () const noexcept |
| Calculate bounding box. | |
| void | tryRemoveLayers () noexcept |
| std::vector< BezierPoint >::const_iterator | beginContour (ssize_t contourNr) const noexcept |
| std::vector< BezierPoint >::const_iterator | endContour (ssize_t contourNr) const noexcept |
| ssize_t | beginLayer (ssize_t layerNr) const noexcept |
| ssize_t | endLayer (ssize_t layerNr) const noexcept |
| std::vector< BezierPoint > | getBezierPointsOfContour (ssize_t contourNr) const noexcept |
| std::vector< BezierCurve > | getBeziersOfContour (ssize_t contourNr) const noexcept |
| std::vector< BezierCurve > | getBeziers () const noexcept |
| std::pair< Path, vec > | getLayer (ssize_t layerNr) const noexcept |
| vec | getColorOfLayer (ssize_t layerNr) const noexcept |
| void | setColorOfLayer (ssize_t layerNr, vec fillColor) noexcept |
| bool | isContourOpen () const noexcept |
| void | closeContour () noexcept |
| bool | hasLayers () const noexcept |
| bool | isLayerOpen () const noexcept |
| void | closeLayer (vec fillColor) noexcept |
| void | optimizeLayers () noexcept |
| Optimize layers. | |
| vec | currentPosition () const noexcept |
| void | moveTo (vec position) noexcept |
| void | moveRelativeTo (vec direction) noexcept |
| void | lineTo (vec position) noexcept |
| void | lineRelativeTo (vec direction) noexcept |
| void | quadraticCurveTo (vec controlPosition, vec position) noexcept |
| void | quadraticCurveRelativeTo (vec controlDirection, vec direction) noexcept |
| void | cubicCurveTo (vec controlPosition1, vec controlPosition2, vec position) noexcept |
| void | cubicCurveRelativeTo (vec controlDirection1, vec controlDirection2, vec direction) noexcept |
| void | arcTo (float radius, vec position) noexcept |
| void | addRectangle (aarect r, vec corners={0.0f, 0.0f, 0.0f, 0.0f}) noexcept |
| void | addCircle (vec position, float radius) noexcept |
| void | addContour (std::vector< BezierCurve > const &contour) noexcept |
| void | addContour (std::vector< BezierPoint >::const_iterator const &begin, std::vector< BezierPoint >::const_iterator const &end) noexcept |
| void | addContour (std::vector< BezierPoint > const &contour) noexcept |
| void | addPath (Path const &path, vec fillColor) noexcept |
| void | addStroke (Path const &path, vec strokeColor, float strokeWidth, LineJoinStyle lineJoinStyle=LineJoinStyle::Miter, float tolerance=0.05f) noexcept |
| Path | toStroke (float strokeWidth=1.0f, LineJoinStyle lineJoinStyle=LineJoinStyle::Miter, float tolerance=0.05f) const noexcept |
| Path | centerScale (vec extent, float padding=0.0) const noexcept |
| Center and scale a path inside the extent with padding. | |
| Path & | operator+= (Path const &rhs) noexcept |
| template<typename M , std::enable_if_t< is_mat_v< M >, int > = 0> | |
| Path & | operator*= (M const &rhs) noexcept |
Data Fields | |
| std::vector< BezierPoint > | points |
| std::vector< ssize_t > | contourEndPoints |
| std::vector< std::pair< ssize_t, vec > > | layerEndContours |
Friends | |
| Path | operator+ (Path lhs, Path const &rhs) noexcept |
| template<typename M , std::enable_if_t< is_mat_v< M >, int > = 0> | |
| Path | operator* (M const &lhs, Path rhs) noexcept |
A path is a vector graphics object. It represents:
|
noexcept |
Draw a circle.
| position | position of the center of the circle. |
| radius | radius of the circle |
|
noexcept |
Contour with the given bezier curves. The first anchor will be ignored.
|
noexcept |
Curve with the given bezier curve. The first anchor will be ignored.
|
noexcept |
Curve with the given bezier curve. The first anchor will be ignored.
Draw a rectangle.
| aarect | the offset and size of the rectangle. |
| corner | radius of <bottom-left, bottom-right, top-left, top-right> positive corner are rounded, negative curves are cut. |
|
noexcept |
Stroke a path and close layer.
|
noexcept |
Check if all layers have the same color.
|
noexcept |
Draw an circular arc. The arc is drawn from the current position to the position given in this method. A positive arc is drawn counter-clockwise.
Using method in: "Approximation of a cubic bezier curve by circular arcs and vice versa" – Aleksas Riškus (chapter 3, formulas 8 and 9, there are a few typos in the formulas)
| radius | positive radius means positive arc, negative radius is a negative arc. |
| position | end position of the arc. |
|
noexcept |
Return an iterator to the start point of a contour.
|
noexcept |
Calculate bounding box.
Center and scale a path inside the extent with padding.
|
inlinenoexcept |
Clear the path.
|
noexcept |
Close current contour. No operation if there is no open contour.
|
noexcept |
Close current contour. No operation if there is no open layer.
|
noexcept |
Draw curve from the current position to the new direction.
| controlDirection | control point of the curve relative from the start of the curve. |
| direction | end point of the curve relative from the start of the curve. |
|
noexcept |
Get the currentPosition of the open contour. Returns {0, 0} when there is no contour open.
|
noexcept |
This path has layers.
|
noexcept |
Return true if there is an open contour.
|
noexcept |
Return true if there is an open layer.
|
noexcept |
Start a new contour relative to current position. closes current subpath.
|
noexcept |
Start a new contour at position. closes current subpath.
|
noexcept |
Return the number of closed contours.
|
noexcept |
Return the number of closed layers.
|
noexcept |
Optimize layers.
Merge contiguous layers with the same color.
Draw curve from the current position to the new direction.
| controlDirection | control point of the curve relative from the start of the curve. |
| direction | end point of the curve relative from the start of the curve. |
|
noexcept |
Convert path to stroke-path.
This function will create contours that are offset from the original path which creates a stroke. The path will first be subdivided until the curves are mostly flat, then the curves are converted into lines and offset, then the lines are connected to each other.
| strokeWidth | width of the stroke. |
| lineJoinStyle | the style of how outside corners of a stroke are drawn. |
| tolerance | Tolerance of how flat the curves in the path need to be. |
|
noexcept |
Try to move the layers in a path. Layers are removed if there are layers, and all the layers have the same color.
| std::vector<ssize_t> tt::Path::contourEndPoints |
An index into
| std::vector<std::pair<ssize_t,vec> > tt::Path::layerEndContours |
An color and index into
| std::vector<BezierPoint> tt::Path::points |
A set of all bezier points describing all bezier curves, contours and layers.