Recent

Author Topic: Gtk TCanvas.Arc vs. Delphi  (Read 5882 times)

hy

  • Full Member
  • ***
  • Posts: 213
Gtk TCanvas.Arc vs. Delphi
« on: September 23, 2014, 08:00:58 pm »
Hi,
As already stated somewhere else I am porting a big project from Delphi to Lazarus.
Most of the app is displayed graphically on a TCanvas.
I am making use of Method arc a lot.
Obviously the Arc-Method does not behave like arc in delphi.
The first 4 parameters are equal but then there are 4 parameters I do not undrestand - at least not the last 2
See: http://lazarus-ccr.sourceforge.net/docs/lcl/graphics/tcanvas.arc.html
I do not know what to do. Trial and error did not get me somewhere...
I tried Pie and radial pie but they are different and draw additional lines that I do not want.
Any help apreciated - Thanks in advance
_____
***hy
OS: debian sid(64bit)  [fpc 3.0.4] Lazarus SVN

howardpc

  • Hero Member
  • *****
  • Posts: 3210
Re: Gtk TCanvas.Arc vs. Delphi
« Reply #1 on: September 23, 2014, 11:21:28 pm »
If you  use the overloaded Arc() which takes 8 integer parameters, the first four specify the enclosing rectangle of the ellipse from which the arc is a segment, params 5 and 6 are the start point, and params 7 and 8 the end point. 'Start' and 'end' being counterclockwise movement round the ellipse perimeter.
The parameter that does not have to be given is the centre point of the ellipse (since it can be determined from the first four parameters).
The arc drawn is the curve between the intersection of the (imaginary) start line (centre to start point) with the ellipse, and the intersection of the end line (centre to end point) with the ellipse.

hy

  • Full Member
  • ***
  • Posts: 213
Re: Gtk TCanvas.Arc vs. Delphi
« Reply #2 on: September 23, 2014, 11:25:15 pm »
Thanks for answering. Meanwhile I found out by trial and error.
I will post a demo tomorrow. Ithink I got that now, but have to go to bed now.
_____
***hy
OS: debian sid(64bit)  [fpc 3.0.4] Lazarus SVN

hy

  • Full Member
  • ***
  • Posts: 213
Re: Gtk TCanvas.Arc vs. Delphi
« Reply #3 on: September 24, 2014, 11:19:52 am »
Attached you will find a simple demoproject.
You can play around and test for yourself.
There is some explanation in source code how arc works with lazarus (using gtk)
_____
***hy
OS: debian sid(64bit)  [fpc 3.0.4] Lazarus SVN