[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Paint.Arc draw direction
[Thread Prev] | [Thread Next]
- Subject: Re: Paint.Arc draw direction
- From: Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
- Date: Tue, 17 Feb 2026 23:27:10 +0100
- To: user@xxxxxxxxxxxxxxxxxxxxxx
Le 17/02/2026 à 22:41, Lee a écrit :
On 2/17/26 2:03 PM, Claus Dietrich wrote:Hi lee Am 16.02.26 um 16:10 schrieb Lee:Just to confirm, am I misunderstanding the documentation, or is it in need of correction?I typically draw circles with following transformation matrix:Paint.Translate($iDrawCenterX, $iDrawCenterY) Paint.Scale(1, -1) Paint.Arc(0, 0, $iRadius, 0, Rad(90))With this, arc is drawn as documented. Could it be, that the documentation was inadvertently written under the application ofsuch transformation matrix? From my point of view the sentence "If _Length_ is negative, then the arc is drawn clockwise." is wrong and I suggest to remove it from the documentation. Best regards, ClausThank 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 lengthin degrees) are negative. However, the Paint.Arc() method in the component (at lines 911,912of / 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 theangles, the Wiki documentation is also reversed. I would like further confirmation before I "correct" the Wiki and risk actually making it incorrect.
It's the wiki that is false. The implementation actually follows Cairo, which does the contrary of Qt, i.e. it draws arcs clockwise if the angles are positive, and counter-clockwise otherwise. Regards, -- Benoît Minisini.
| Re: Paint.Arc draw direction | Lee <t.lee.davidson@xxxxxxxxx> |
| Paint.Arc draw direction | Lee <t.lee.davidson@xxxxxxxxx> |
| Re: Paint.Arc draw direction | Claus Dietrich <claus.dietrich@xxxxxxxxxx> |
| Re: Paint.Arc draw direction | Lee <t.lee.davidson@xxxxxxxxx> |