How to use the Path class?

I am confused with the use of Path class. Is there any specific tutorials for this class?


They are at the top of your knob horizontally centred. But then you apply a rotation, and it appears where you see them now.

The path’s coordinates are centred around the middle, the rotation is applied first, then it is moved, so the 0, 0 is located in the centre of the knob.

1 Like

Here, the added rectangle’s x and y coordinates are negative。

Yes, apologies for the cryptic wording:
When adding the rectangle, it assumes a coordinate system centred around 0.0 and painting at 12’o clock.
Then it applies a rotation to reflect the selected angle:
AffineTransform::rotation (angle)
and as second step it translates the 0,0 centred coordinates to centreX, centreY:
.translated (centreX, centreY).
This combined transformation is now applied to the path:
p.applyTransform (...)

1 Like