StrokeShapes.h header
#include <ew/app/StrokeShapes.h>
Namespace ew::app
Functions
ew::core::conlang::Stroke ew::app::script::arcStroke(double centerX, double centerY, double radius, double startDegrees, double endDegrees, int segments)
An arc of the circle centred on (centerX, centerY) with radius radius, from startDegrees to endDegrees clockwise, as an open stroke of segments points.
ew::core::conlang::Stroke ew::app::script::circleStroke(double centerX, double centerY, double radius, int segments)
A circle centred on (centerX, centerY) with radius radius, as a closed stroke of segments points.
ew::core::conlang::Stroke ew::app::script::constrainedToSquare(const ew::core::conlang::Stroke &stroke, double originX, double originY)
stroke constrained to a square/circular aspect about (originX, originY) – the shift-drag behaviour, applied to the bounds rather than to each tool separately.
ew::core::conlang::StrokePoint ew::app::script::cornerPoint(double x, double y)
The drawing tools, each constructing a ew::core::conlang::Stroke from the drag or the clicks that made it.
Every tool here returns the SAME primitive freehand does: an ordered list of points. That is the decision the whole canvas rests on. A rectangle that stayed a rectangle object could be moved and resized but never pulled into a serif, so the moment a user wanted a letterform rather than a diagram the tool would be useless to them – and half the editing tools would have to grow a second code path for shapes. Because every tool emits points, every editing tool (drag a point, insert one, delete one, simplify, smooth, join, split, transform a selection) works on every tool's output for free.
All coordinates are glyph-box normalised (0..1), like the model they build. A corner point at (x, y) – the default for a constructed shape, whose vertices are deliberate angles rather than samples through a curve.
ew::core::conlang::Stroke ew::app::script::cubicStroke(double x1, double y1, double c1x, double c1y, double c2x, double c2y, double x2, double y2, int segments)
A cubic Bezier from (x1, y1) to (x2, y2) with control points (c1x, c1y) and (c2x, c2y), as an open stroke of segments points.
ew::core::conlang::Stroke ew::app::script::ellipseStroke(double x1, double y1, double x2, double y2, int segments)
An ellipse inscribed in the box with opposite corners (x1, y1) and (x2, y2), as a closed stroke of segments points.
ew::core::conlang::Stroke ew::app::script::lineStroke(double x1, double y1, double x2, double y2)
A straight line from (x1, y1) to (x2, y2).
ew::core::conlang::Stroke ew::app::script::mirroredAcrossHorizontal(const ew::core::conlang::Stroke &stroke, double axisY)
stroke mirrored across the horizontal line at axisY.
ew::core::conlang::Stroke ew::app::script::mirroredAcrossVertical(const ew::core::conlang::Stroke &stroke, double axisX)
stroke mirrored across the vertical line at axisX, for a symmetry-mode counterpart.
Most invented alphabets are built on an axis, and drawing both halves by hand guarantees they differ – which reads as a wobbly script rather than as a designed one.
ew::core::conlang::Stroke ew::app::script::polygonStroke(double centerX, double centerY, double radius, int sides, double rotationDegrees)
A regular polygon of sides vertices, centred on (centerX, centerY) with circumradius radius, its first vertex at rotationDegrees clockwise from straight up.
ew::core::conlang::Stroke ew::app::script::polylineStroke(const std::vector< ew::core::conlang::StrokePoint > &points)
A polyline through points, in order.
ew::core::conlang::Stroke ew::app::script::quadraticStroke(double x1, double y1, double cx, double cy, double x2, double y2, int segments)
A quadratic Bezier from (x1, y1) to (x2, y2) bending toward the control point (cx, cy), as an open stroke of segments points.
Flattened to points rather than kept as control handles: the stored form is the same list of points every other tool produces, so the curve stays editable point by point after it is drawn.
ew::core::conlang::Stroke ew::app::script::rectangleStroke(double x1, double y1, double x2, double y2)
A rectangle with opposite corners (x1, y1) and (x2, y2), as a closed four-point stroke.
ew::core::conlang::Stroke ew::app::script::roundedRectangleStroke(double x1, double y1, double x2, double y2, double radius, int segments)
A rectangle with its corners rounded to radius, as a closed stroke; segments points per corner arc.
A radius past half the shorter side is clamped, so dragging the control past the middle gives a stadium rather than a self-crossing tangle.
ew::core::conlang::Stroke ew::app::script::starStroke(double centerX, double centerY, double outerRadius, double innerRadius, int points, double rotationDegrees)
A star of points spikes alternating between outerRadius and innerRadius, centred on (centerX, centerY), its first spike at rotationDegrees clockwise from straight up.