[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Paint.Arc draw direction


Am 17.02.26 um 22:41 schrieb Lee:
Thank you for your response, Claus.

I don't know exactly what Paint.Scale() does, but if I use "Paint.Scale(1, 1)" the arc is drawn clockwise.

I have looked at the code for the Paint component and the documentation for Qt's QPainterPath class; specifically for QPainterPath::arcTo [https://doc.qt.io/qt-6/qpainterpath.html#arcTo].

The Qt documentation does indeed state that arcs are drawn counter-clockwise and clockwise if the angles (which includes the arc length in degrees) are negative.

However, the Paint.Arc() method in the component (at lines 911,912 of /gb.qt4/src/cpaint_impl.cpp) reverses the sign of the angles:
    angle = - angle;
    length = - length;

Perhaps Paint.Scale(1, -1) effectively makes that angles negative which would make them be drawn clockwise, but Paint.Arc reverses the signs again making the arc be drawn counter-clockwise. Unfortunately, transformation matrices are above my pay grade 😉

I have to conclude that the Wiki documentation follows the Qt documentation, but since the component reverses the signs of the angles, the Wiki documentation is also reversed. I would like further confirmation before I "correct" the Wiki and risk actually making it incorrect.

The documentation of cairo actually tells the opposit of the Gambas wiki says:

https://www.cairographics.org/manual/cairo-Paths.html#cairo-arc

So I am assuming that the Gambas documentatiion is wrong.

Best regards, Claus


References:
Paint.Arc draw directionLee <t.lee.davidson@xxxxxxxxx>
Re: Paint.Arc draw directionClaus Dietrich <claus.dietrich@xxxxxxxxxx>
Re: Paint.Arc draw directionLee <t.lee.davidson@xxxxxxxxx>