Path¶
- detroit.path(digits: int | None = None)¶
Builds a path serializer
- Parameters:
digits (int | None) – Number of digits to round
- Returns:
New path serializer
- Return type:
- class detroit.path.path.Path(digits: int | None = None)¶
Builds a path serializer
- Parameters:
digits (int | None) – Number of digits to round
- Returns:
New path serializer
- Return type:
- move_to(x: int | float, y: int | float)¶
Move to the specified point (x, y).
- Parameters:
x (int | float) – x position
y (int | float) – y position
- close_path()¶
Ends the current subpath and causes an automatic straight line to be drawn from the current point to the initial point of the current subpath.
- line_to(x: int | float, y: int | float)¶
Draws a straight line from the current point to the specified point (x, y).
- Parameters:
x (int | float) – x position
y (int | float) – y position
- quadratic_curve_to(cpx: int | float, cpy: int | float, x: int | float, y: int | float)¶
Draws a quadratic Bézier segment from the current point to the specified point (x, y), with the specified control point (cpx, cpy).
- Parameters:
cpx (int | float) – Specified control x position
cpy (int | float) – Specified control y position
x (int | float) – x position
y (int | float) – y position
- bezier_curve_to(cpx1: int | float, cpy1: int | float, cpx2: int | float, cpy2: int | float, x: int | float, y: int | float)¶
Draws a cubic Bézier segment from the current point to the specified point (x, y), with the specified control points (cpx1, cpy1) and (cpx2, cpy2).
- Parameters:
cpx1 (int | float) – Specified control x position 1
cpy1 (int | float) – Specified control y position 1
cpx2 (int | float) – Specified control x position 2
cpy2 (int | float) – Specified control y position 2
x (int | float) – x position
y (int | float) – y position
- arc_to(x1: int | float, y1: int | float, x2: int | float, y2: int | float, r: int | float)¶
Draws a circular arc segment with the specified radius that starts tangent to the line between the current point and the specified point (x1, y1) and ends tangent to the line between the specified points (x1, y1) and (x2, y2). If the first tangent point is not equal to the current point, a straight line is drawn between the current point and the first tangent point.
- Parameters:
x1 (int | float) – Arc x position
y1 (int | float) – Arc y position
x2 (int | float) – Tangent x position
y2 (int | float) – Tangent y position
r (int | float) – Arc radius
- arc(x: int | float, y: int | float, r: int | float, start_angle: int | float, end_angle: int | float, ccw: bool = False)¶
Draws a circular arc segment with the specified center (x, y), radius, start_angle and end_angle. If anticlockwise is true, the arc is drawn in the anticlockwise direction; otherwise, it is drawn in the clockwise direction. If the current point is not equal to the starting point of the arc, a straight line is drawn from the current point to the start of the arc.
- Parameters:
x (int | float) – Center x position
y (int | float) – Center y position
r (int | float) – Radius
start_angle (int | float) – Start angle
end_angle (int | float) – End angle
ccw (bool) – Clockwise direction
- rect(x: int | float, y: int | float, w: int | float, h: int | float)¶
Creates a new subpath containing just the four points (x, y), (x + w, y), (x + w, y + h), (x, y + h), with those four points connected by straight lines, and then marks the subpath as closed.
- Parameters:
x (int | float) – Rectangle x position
y (int | float) – Rectangle y position
w (int | float) – Rectangle width
h (int | float) – Rectangle height