Accumulates shapes as a triangle list of MeshVertex. More...
#include <GuiGeometry.h>
Public Member Functions | |
| GuiMesh (float featherWidth=1.0f, float curveTolerance=0.3f) | |
| Constructor. | |
| void | clear () |
| Removes all geometry (keeps the feather and tolerance settings) | |
| size_t | size () const |
| Gets the number of vertices (a multiple of 3) | |
| bool | empty () const |
| Checks whether the mesh has no geometry. | |
| const std::vector< MeshVertex > & | vertices () const |
| Gets the triangle list. | |
| float | getFeather () const |
| Gets the feather width the mesh was built with. | |
| float | getTolerance () const |
| Gets the curve tolerance the mesh was built with. | |
| void | addRect (const GuiRect &r, const GuiFill &fill, bool edgeFringe=true) |
| Adds a filled rectangle. | |
| void | addRoundRect (const GuiRect &r, const GuiCorners &corners, const GuiFill &fill, bool edgeFringe=true) |
| Adds a filled rounded rectangle. | |
| void | addEllipse (const GuiRect &r, const GuiFill &fill, bool edgeFringe=true) |
| Adds a filled ellipse inscribed in a rectangle (a circle when w == h) | |
| void | addPolygon (const std::vector< GuiPoint > &pts, const GuiFill &fill, bool edgeFringe=true) |
| Adds a filled polygon (triangle, chevron, a controller silhouette, ...). | |
| void | addLine (GuiPoint a, GuiPoint b, float width, const GuiFill &fill) |
| Adds a straight line with flat ends. | |
| void | strokeRoundRect (const GuiRect &r, const GuiCorners &corners, float width, STROKE align, const GuiFill &fill) |
| Adds a rounded-rectangle outline. | |
| void | strokeEllipse (const GuiRect &r, float width, STROKE align, const GuiFill &fill) |
| Adds an ellipse outline. | |
| void | strokePolygon (const std::vector< GuiPoint > &pts, float width, STROKE align, const GuiFill &fill) |
| Adds a polygon outline with mitered corners (the miter is capped on very sharp corners). | |
| void | strokeArc (GuiPoint centre, float radius, float startDeg, float sweepDeg, float width, PixelColor color) |
| Adds an arc stroke centered on a radius, with flat ends. | |
| void | addShadow (const GuiRect &r, const GuiCorners &corners, float blur, float spread, float dx, float dy, PixelColor color) |
| Adds a soft drop shadow or glow for a rounded rectangle. | |
Accumulates shapes as a triangle list of MeshVertex.
Build one when a shape's size or style changes and keep it; drawing it again is free of any geometry work.
Definition at line 127 of file GuiGeometry.h.
| GuiMesh::GuiMesh | ( | float | featherWidth = 1.0f, |
| float | curveTolerance = 0.3f ) |
Constructor.
| featherWidth | Width of the anti-aliasing fringe, in design-canvas pixels. Pass 1 / VideoDriver::getUIScale() for a one-physical-pixel fringe; 0 disables it. |
| curveTolerance | Largest allowed distance between a true curve and its polygon approximation, in design-canvas pixels |
Definition at line 477 of file GuiGeometry.cpp.
Adds a filled ellipse inscribed in a rectangle (a circle when w == h)
| edgeFringe | see addRoundRect() |
Definition at line 565 of file GuiGeometry.cpp.
Adds a straight line with flat ends.
Definition at line 589 of file GuiGeometry.cpp.
| void GuiMesh::addPolygon | ( | const std::vector< GuiPoint > & | pts, |
| const GuiFill & | fill, | ||
| bool | edgeFringe = true ) |
Adds a filled polygon (triangle, chevron, a controller silhouette, ...).
The polygon may be concave but must not cross itself. A convex one is filled as a fan; a concave one is triangulated (ear clipping, quadratic in the vertex count, so build it once and keep the mesh).
Definition at line 575 of file GuiGeometry.cpp.
Adds a filled rectangle.
Definition at line 538 of file GuiGeometry.cpp.
| void GuiMesh::addRoundRect | ( | const GuiRect & | r, |
| const GuiCorners & | corners, | ||
| const GuiFill & | fill, | ||
| bool | edgeFringe = true ) |
Adds a filled rounded rectangle.
Corner radius h/2 makes a capsule.
| edgeFringe | false leaves out the anti-aliased edge, for a fill whose edge is entirely covered by an opaque outline drawn on top of it (saves a third of the fill's triangles) |
Definition at line 548 of file GuiGeometry.cpp.
| void GuiMesh::addShadow | ( | const GuiRect & | r, |
| const GuiCorners & | corners, | ||
| float | blur, | ||
| float | spread, | ||
| float | dx, | ||
| float | dy, | ||
| PixelColor | color ) |
Adds a soft drop shadow or glow for a rounded rectangle.
Draw it before the shape it belongs to.
| blur | Width of the soft edge |
| spread | Grows (positive) or shrinks (negative) the shadow's edge |
| dx | Horizontal offset |
| dy | Vertical offset |
| color | Shadow color; its alpha is the shadow's peak opacity |
Definition at line 714 of file GuiGeometry.cpp.
| void GuiMesh::clear | ( | ) |
Removes all geometry (keeps the feather and tolerance settings)
Definition at line 482 of file GuiGeometry.cpp.
|
inline |
Checks whether the mesh has no geometry.
Definition at line 142 of file GuiGeometry.h.
|
inline |
Gets the feather width the mesh was built with.
Definition at line 146 of file GuiGeometry.h.
|
inline |
Gets the curve tolerance the mesh was built with.
Definition at line 148 of file GuiGeometry.h.
|
inline |
Gets the number of vertices (a multiple of 3)
Definition at line 140 of file GuiGeometry.h.
| void GuiMesh::strokeArc | ( | GuiPoint | centre, |
| float | radius, | ||
| float | startDeg, | ||
| float | sweepDeg, | ||
| float | width, | ||
| PixelColor | color ) |
Adds an arc stroke centered on a radius, with flat ends.
Used for progress rings. Angles are in degrees, 0 = +X (right), increasing clockwise on screen.
Definition at line 642 of file GuiGeometry.cpp.
Adds an ellipse outline.
Definition at line 619 of file GuiGeometry.cpp.
| void GuiMesh::strokePolygon | ( | const std::vector< GuiPoint > & | pts, |
| float | width, | ||
| STROKE | align, | ||
| const GuiFill & | fill ) |
Adds a polygon outline with mitered corners (the miter is capped on very sharp corners).
A concave polygon works as long as the stroke is thin compared with its smallest notch.
Definition at line 633 of file GuiGeometry.cpp.
| void GuiMesh::strokeRoundRect | ( | const GuiRect & | r, |
| const GuiCorners & | corners, | ||
| float | width, | ||
| STROKE | align, | ||
| const GuiFill & | fill ) |
Adds a rounded-rectangle outline.
Definition at line 604 of file GuiGeometry.cpp.
|
inline |
Gets the triangle list.
Definition at line 144 of file GuiGeometry.h.