wxGraphicsPath(3)
π wxGraphicsPath π
okay bestie, gather round, because we're talking about wxGraphicsPath β and yes, this is the Erlang module definition, it's from the wx app, and it is lowkey iconic. π¦
β¨ NAME β¨
wxGraphicsPath β a wxGraphicsPath is a native representation of a geometric path. π
πΈ DESCRIPTION πΈ
So what even is it? It's a native representation of a geometric path. That's the whole vibe.
The contents are specific and private to the respective renderer. Instances are reference counted and can therefore be assigned as usual. And listen β the only way to get a valid instance is by using wxGraphicsContext:createPath/1 or wxGraphicsRenderer:createPath/1. No shortcuts, no DIY, that's the rule. π
This class is derived, and can use functions, from:
wxGraphicsObject
wxWidgets docs: wxGraphicsPath
π DATA TYPES π
wxGraphicsPath() :: wx:wx_object().
π FUNCTIONS π
π addArc π
addArc(This, C, R, StartAngle, EndAngle, Clockwise) -> ok
when
This :: wxGraphicsPath(),
C :: {X :: float(), Y :: float()},
R :: number(),
StartAngle :: number(),
EndAngle :: number(),
Clockwise :: boolean().
addArc(This, X, Y, R, StartAngle, EndAngle, Clockwise) -> ok
when
This :: wxGraphicsPath(),
X :: number(),
Y :: number(),
R :: number(),
StartAngle :: number(),
EndAngle :: number(),
Clockwise :: boolean().
Adds an arc of a circle, bestie. π
The circle is defined by the coordinates of its centre (x, y) or c and its radius r. The arc goes from the starting angle startAngle to endAngle either clockwise or counter-clockwise depending on the value of clockwise argument.
The angles are measured in radians but, contrary to the usual mathematical convention, are always clockwise from the horizontal axis. yes, this is the chaos, we accept it. π
If for clockwise arc endAngle is less than startAngle it will be progressively increased by 2*pi until it is greater than startAngle. If for counter-clockwise arc endAngle is greater than startAngle it will be progressively decreased by 2*pi until it is less than startAngle.
If there is a current point set, an initial line segment will be added to the path to connect the current point to the beginning of the arc.
π«Ά addArcToPoint π«Ά
addArcToPoint(This, X1, Y1, X2, Y2, R) -> ok
when
This :: wxGraphicsPath(),
X1 :: number(),
Y1 :: number(),
X2 :: number(),
Y2 :: number(),
R :: number().
Adds an arc (of a circle with radius r) that is tangent to the line connecting the current point and (x1, y1) and to the line connecting (x1, y1) and (x2, y2). geometry girlies rise up π
If the current point and the starting point of the arc are different, a straight line connecting these points is also appended. If there is no current point before the call to addArcToPoint/6 this function will behave as if preceded by a call to MoveToPoint(0, 0). After this call the current point will be at the ending point of the arc.
π addCircle π
addCircle(This, X, Y, R) -> ok
when
This :: wxGraphicsPath(),
X :: number(),
Y :: number(),
R :: number().
Appends a circle around (x,y) with radius r as a new closed subpath. β
After this call the current point will be at (x+r, y).
π addCurveToPoint π
addCurveToPoint(This, C1, C2, E) -> ok
when
This :: wxGraphicsPath(),
C1 :: {X :: float(), Y :: float()},
C2 :: {X :: float(), Y :: float()},
E :: {X :: float(), Y :: float()}.
addCurveToPoint(This, Cx1, Cy1, Cx2, Cy2, X, Y) -> ok
when
This :: wxGraphicsPath(),
Cx1 :: number(),
Cy1 :: number(),
Cx2 :: number(),
Cy2 :: number(),
X :: number(),
Y :: number().
Adds a cubic bezier curve from the current point, using two control points and an end point. so smooth, so chic. π
If there is no current point before the call to addCurveToPoint/7 this function will behave as if preceded by a call to MoveToPoint(c1) β and yeah that's the tuple-shaped c1 version, or MoveToPoint(cx1, cy1) for the numbers version.
π¦ addEllipse π¦
addEllipse(This, X, Y, W, H) -> ok
when
This :: wxGraphicsPath(),
X :: number(),
Y :: number(),
W :: number(),
H :: number().
Appends an ellipse fitting into the passed in rectangle as a new closed subpath.
After this call the current point will be at (x+w, y+h/2).
β¨ addLineToPoint β¨
addLineToPoint(This, P) -> ok
when
This :: wxGraphicsPath(),
P :: {X :: float(), Y :: float()}.
addLineToPoint(This, X, Y) -> ok
when
This :: wxGraphicsPath(),
X :: number(),
Y :: number().
Adds a straight line from the current point to p (or to (x,y), same energy). π
If current point is not yet set before the call to addLineToPoint/3 this function will behave as moveToPoint/3.
π addPath π
addPath(This, Path) -> ok
when This :: wxGraphicsPath(), Path ::
wxGraphicsPath().
Adds another path onto the current path. stacking paths like stacking accessories, obsessed. π
After this call the current point will be at the added path's current point. For Direct2D the path being appended shouldn't contain a started non-empty subpath when this function is called. β οΈ
πΈ addQuadCurveToPoint πΈ
addQuadCurveToPoint(This, Cx, Cy, X, Y) -> ok
when
This :: wxGraphicsPath(),
Cx :: number(),
Cy :: number(),
X :: number(),
Y :: number().
Adds a quadratic bezier curve from the current point, using a control point and an end point. π
If there is no current point before the call to addQuadCurveToPoint/5 this function will behave as if preceded by a call to MoveToPoint(cx, cy).
π addRectangle π
addRectangle(This, X, Y, W, H) -> ok
when
This :: wxGraphicsPath(),
X :: number(),
Y :: number(),
W :: number(),
H :: number().
Appends a rectangle as a new closed subpath. π²
After this call the current point will be at (x, y).
π addRoundedRectangle π
addRoundedRectangle(This, X, Y, W, H, Radius) -> ok
when
This :: wxGraphicsPath(),
X :: number(),
Y :: number(),
W :: number(),
H :: number(),
Radius :: number().
Appends a rounded rectangle as a new closed subpath. the softest of the rectangles, fr fr. π«Ά
If radius equals 0 this function will behave as addRectangle/5, otherwise after this call the current point will be at (x+w, y+h/2).
π closeSubpath π
closeSubpath(This) -> ok when This :: wxGraphicsPath().
Closes the current sub-path.
After this call the current point will be at the joined endpoint of the sub-path.
π₯ contains π₯
contains(This, X, Y) -> boolean()
when
This :: wxGraphicsPath(),
X :: number(),
Y :: number();
(This, C, [Option]) -> boolean()
when
This :: wxGraphicsPath(),
C :: {X :: float(), Y :: float()},
Option :: {fillStyle, wx:wx_enum()}.
contains(This, X, Y, [Option]) -> boolean()
when
This :: wxGraphicsPath(),
X :: number(),
Y :: number(),
Option :: {fillStyle, wx:wx_enum()}.
Return: true if the point is within the path. vibe check the point, basically. β
heads up: theOptionhere is{fillStyle, wx:wx_enum()}β so like,fillStyletakes awx:wx_enum()value. π
π getBox π
getBox(This) ->
{X :: float(), Y :: float(), W :: float(), H :: float()}
when This :: wxGraphicsPath().
Gets the bounding box enclosing all points (possibly including control points). yes, possibly β don't come for me. π¦
π¦ getCurrentPoint π¦
getCurrentPoint(This) -> {X :: float(), Y :: float()}
when This :: wxGraphicsPath().
Gets the last point of the current path, (0,0) if not yet set. default behaviour, we love her. β¨
π moveToPoint π
moveToPoint(This, P) -> ok
when
This :: wxGraphicsPath(),
P :: {X :: float(), Y :: float()}.
moveToPoint(This, X, Y) -> ok
when
This :: wxGraphicsPath(),
X :: number(),
Y :: number().
Begins a new subpath at p β or at (x,y). main character energy, new beginning. π
π
transform π
transform(This, Matrix) -> ok
when
This :: wxGraphicsPath(),
Matrix :: wxGraphicsMatrix:wxGraphicsMatrix().
Transforms each point of this path by the matrix. π«
For Direct2D the current path shouldn't contain a started non-empty subpath when this function is called. β οΈ (yes bestie, same warning as addPath, Direct2D said no half-finished subpaths at the function call, periodt.)
β οΈ also, the Direct2D notes are real, so if Direct2D is in the building, make sure your subpaths are closed before you calladdPathortransform. no cap.
that's the whole page!! go forth and draw paths, you beautiful genius π«Άπ
mwah π β brought to you by Ericsson AB, wx 2.6, and this little module page named wxGraphicsPath.
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms