I'm working on a custom pyQt SVG renderer and need help. This is purely mathematical so you won't need an API.
To calculate a SVG elliptical arc you need two radii rx
and ry
; the rotation of the ellipse in degrees x-axis-rotation
; the large-arc-sweep-flag
(1 or 0) that determines if an arc is drawn through greater than or less than 180 degrees and the direction of the arc around the circle; the sweep-flag
(1 or 0) determines if the arc will be drawn in a negative or positive direction; and the final x
and y
values determine the end of the arc.
However, QPainterPath.arcTo(self, float x, float y, float w, float h, float startAngle, float arcLenght)
uses a bounding rectangle x, y, w, h
; a starting angle startAngle
; and an arcLength/sweepLength the length of the arc itself. How do I translate the SVG command to something the arcTo()
method can use?
Sources: W3C SVG, QPainterPath