Platform-agnostic tessellation of rounded rectangles, ellipses, polygons, strokes, arcs, gradients and soft shadows into anti-aliased triangle meshes (GuiMesh). More...
Classes | |
| struct | GuiPoint |
| A 2D point in design-canvas pixels. More... | |
| struct | GuiRect |
| An axis-aligned rectangle (top-left origin) in design-canvas pixels. More... | |
| struct | GuiCorners |
| Per-corner radii, in the order top-left, top-right, bottom-right, bottom-left. More... | |
| struct | GuiFill |
| A solid color or a two-color linear gradient. More... | |
| struct | GuiPath |
| A closed outline made of straight lines and cubic Beziers, in whatever units the caller likes. More... | |
| class | GuiMesh |
| Accumulates shapes as a triangle list of MeshVertex. More... | |
| class | GuiGlyph |
| A small control icon drawn from shapes: a light badge with a dark symbol or letter, for list rows and hint bars. More... | |
| struct | GuiMeshKey |
| Everything that decides what a shape's triangles are. More... | |
| class | GuiSharedMesh |
| One cached mesh. More... | |
| class | GuiMeshCache |
| Static, since there is one video backend. More... | |
| class | GuiShape |
| A code-drawn shape: a rectangle (optionally rounded) or ellipse with a fill, outline and shadow, and no image assets. More... | |
| struct | GuiTheme |
| Colors, metrics and the style recipes built from them. More... | |
Enumerations | |
| enum class | STROKE { STROKE::INSIDE , STROKE::CENTRE , STROKE::OUTSIDE } |
| Where a stroke sits relative to the shape's geometric edge. More... | |
| enum class | GLYPH { GLYPH::BUTTON , GLYPH::BUMPER , GLYPH::UP , DOWN , LEFT , RIGHT , PLUS , MINUS , GLYPH::STICK , GLYPH::CAPTURE , HOME } |
| Small control icons for lists and hints (the "A" in a circle, a bumper, a D-pad arrow). More... | |
| enum class | SHAPE { SHAPE::RECTANGLE , SHAPE::ELLIPSE , SHAPE::TRIANGLE_UP , SHAPE::TRIANGLE_DOWN , TRIANGLE_LEFT , TRIANGLE_RIGHT } |
| Basic shape kinds a paint can be applied to. More... | |
| enum class | SHAPE_STATE { NORMAL , SHAPE_STATE::FOCUSED , PRESSED , DISABLED } |
| The states a styled shape distinguishes. More... | |
Functions | |
| std::vector< std::vector< GuiPoint > > | GuiFlattenPath (const GuiPath &path, float scale, float tolerance=0.15f) |
Turns a path into one polygon per contour, multiplied by scale. | |
| GuiRect | GuiPathBounds (const GuiPath &path, float scale=1.0f) |
Gets the bounding box of a path's points (control points included, so it can be a little larger than the drawn curve), multiplied by scale | |
| std::vector< GuiPoint > | GuiRoundRectPolygon (const GuiRect &r, float radius, float angleDeg, float tolerance=0.15f) |
| A rounded rectangle as a convex polygon, rotated about its center. | |
| static void | GuiGlyph::size (GLYPH kind, float &w, float &h) |
| Gets the natural size of a glyph, from the theme (glyphSize, glyphBumperWidth, glyphBumperHeight). | |
| static void | GuiGlyph::build (GuiMesh &mesh, GLYPH kind, float w, float h) |
| Builds a glyph filling a w x h box at the origin, in the theme's light-on-dark colors. | |
| PixelColor | GuiMixColor (PixelColor a, PixelColor b, float t) |
| Blends two colors per channel (alpha included): t = 0 gives a, t = 1 gives b. | |
| void | GuiAddPaintedShape (GuiMesh &mesh, SHAPE shape, const GuiRect &r, const GuiCorners &corners, const GuiPaint &paint) |
| Adds a painted shape to a mesh: shadow first, then fill, then outline. | |
| void | GuiThemeInit (GuiTheme &theme) |
| Fills in every color and metric of the theme. | |
Variables | |
| bool | hasFill |
| The look of a shape: an optional fill, an optional outline and an optional shadow or glow. | |
Platform-agnostic tessellation of rounded rectangles, ellipses, polygons, strokes, arcs, gradients and soft shadows into anti-aliased triangle meshes (GuiMesh).
|
strong |
Small control icons for lists and hints (the "A" in a circle, a bumper, a D-pad arrow).
Definition at line 17 of file GuiGlyph.h.
|
strong |
Basic shape kinds a paint can be applied to.
| Enumerator | |
|---|---|
| RECTANGLE | Rectangle, with optional rounded corners (see GuiCorners) |
| ELLIPSE | Ellipse inscribed in the rectangle (a circle when it is square) |
| TRIANGLE_UP | A triangle pointing up, left or right, apex on the middle of one side and base along the opposite side. |
| TRIANGLE_DOWN | (scroll arrows, the tail of a popover). Fill only: no outline or shadow, and corner radii are ignored |
Definition at line 17 of file GuiPaint.h.
|
strong |
The states a styled shape distinguishes.
| Enumerator | |
|---|---|
| FOCUSED | Highlighted: under the cursor, or selected with the D-pad. |
Definition at line 74 of file GuiPaint.h.
|
strong |
Where a stroke sits relative to the shape's geometric edge.
| Enumerator | |
|---|---|
| INSIDE | Entirely inside the edge (the shape keeps its size) |
| CENTRE | Centered on the edge. |
| OUTSIDE | Entirely outside the edge. |
Definition at line 58 of file GuiGeometry.h.
Builds a glyph filling a w x h box at the origin, in the theme's light-on-dark colors.
Letters are text and are not part of the mesh.
Definition at line 72 of file GuiGlyph.h.
| void GuiAddPaintedShape | ( | GuiMesh & | mesh, |
| SHAPE | shape, | ||
| const GuiRect & | r, | ||
| const GuiCorners & | corners, | ||
| const GuiPaint & | paint ) |
Adds a painted shape to a mesh: shadow first, then fill, then outline.
For SHAPE::ELLIPSE the corner radii are ignored; the shadow of an ellipse follows its outline.
Definition at line 218 of file GuiPaint.cpp.
| std::vector< std::vector< GuiPoint > > GuiFlattenPath | ( | const GuiPath & | path, |
| float | scale, | ||
| float | tolerance = 0.15f ) |
Turns a path into one polygon per contour, multiplied by scale.
Curves are split until no part of the polygon is farther than tolerance from the true curve, so a flat stretch costs one segment and a tight corner costs more. A contour with fewer than 3 points is dropped.
| path | The path |
| scale | Multiplies every coordinate |
| tolerance | Largest allowed distance between the true curve and the polygon, in the scaled units |
Definition at line 812 of file GuiGeometry.cpp.
| PixelColor GuiMixColor | ( | PixelColor | a, |
| PixelColor | b, | ||
| float | t ) |
Blends two colors per channel (alpha included): t = 0 gives a, t = 1 gives b.
Definition at line 268 of file GuiPaint.cpp.
Gets the bounding box of a path's points (control points included, so it can be a little larger than the drawn curve), multiplied by scale
Definition at line 857 of file GuiGeometry.cpp.
| std::vector< GuiPoint > GuiRoundRectPolygon | ( | const GuiRect & | r, |
| float | radius, | ||
| float | angleDeg, | ||
| float | tolerance = 0.15f ) |
A rounded rectangle as a convex polygon, rotated about its center.
Use it where a shape has to be tilted, or where several shapes should merge into one silhouette (draw each piece's outline stroke first and the fills after, and the joins disappear).
| r | Rectangle before rotation |
| radius | Corner radius (clamped to half the shorter side) |
| angleDeg | Rotation in degrees, clockwise on screen |
| tolerance | Largest allowed distance between the true curve and the polygon |
Definition at line 750 of file GuiGeometry.cpp.
| void GuiThemeInit | ( | GuiTheme & | theme | ) |
Fills in every color and metric of the theme.
Defined by the application, like main(): the core has no default look, so a program that does not define it fails to link. Called once, the first time GuiTheme::current() is used; it must not call GuiTheme::current() itself. The libgui template defines it in source/theme.cpp.
|
inlinestatic |
Gets the natural size of a glyph, from the theme (glyphSize, glyphBumperWidth, glyphBumperHeight).
Definition at line 62 of file GuiGlyph.h.
| bool hasFill |
The look of a shape: an optional fill, an optional outline and an optional shadow or glow.
Setters chain, so a paint reads as a sentence: GuiPaint().gradient(top, bottom).stroke(2, edge).shadow(14, black, 0, 4) ! struct GuiPaint { GuiFill fill; /*!< Fill, used when hasFill. Whether the shape is filled.
Definition at line 32 of file GuiPaint.h.