Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2002-08

Canvas, Arc/Chord/Pie etc. & Polybezier

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Andrew Johnson

I really don't know where to send stuff like this, but I have a file of Graphics/Math routines I started initially for Delphi/Kylix Canvas intercompatibility but that later got added to and modified for use with Freepascal and GTK etc. While there are a few bugs(and at the moment is somewhat disorganized), it includes ArcRadialAngles2Points, and reverse for Arc/Chord/Pie routines to enable overloaded canvas routines for each, one with Angle Params: as in Lazarus/Kylix, and one for Radial Points: like in Delphi. A quick hacked example of how to add RadialPoint support to the GTKObject would be :

Uses gdmhroutines;
....
function TgtkObject.Arc(DC: HDC; x,y,width,height : Integer;
  StartPoint, EndPoint : TPoint): Boolean;
var
  Angle1, Angle2 : Extended;
begin
  ArcRadialCoords2Angles(X,Y,X+Width,Y+Height,StartPoint.X,
    StartPoint.Y,EndPoint.X,EndPoint.Y,Angle1,Angle2);
  {Angle results are in 1/64's of a degree for compatibility w/X}
  Result := Arc(DC,x,y,width,height,Trunc(Angle1 / 4),
    Trunc(Angle2 / 4));
end;

There are inconsistencies I haven't worked out in the conversion routines which cause results to be off in one direction or another by exactly 1 degree, though this may actually be a discrepency between Windows and GTK Arcs. I also have initial support for PolyBezier2Polyline since GDK doesn't directly support Beziers which could be used to add a PolyBezier routine. While I can't guarentee a lot on account of my schedule, I know a fair bit about GDK vs WinAPI drawing routines and am willing to submit stuff I already have written, modified for Lazarus. I feel this is one area that Lazarus has always been weak in, and since I couldn't really help out much anywhere else I'd be willing to give a shot at filling in at least some of the gaps.

TTFN
Andrew

_________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com

Reply by email

Mattias Gaertner
to Andrew Johnson

Great :)

Plz send whatever you want to submit to me. I will add it.

Mattias

Show quoted text 48 lines
I really don't know where to send stuff like this, but I have a file of Graphics/Math routines I started initially for Delphi/Kylix Canvas intercompatibility but that later got added to and modified for use with Freepascal and GTK etc. While there are a few bugs(and at the moment is somewhat disorganized), it includes ArcRadialAngles2Points, and reverse for Arc/Chord/Pie routines to enable overloaded canvas routines for each, one with Angle Params: as in Lazarus/Kylix, and one for Radial Points: like in Delphi. A quick hacked example of how to add RadialPoint support to the GTKObject would be : Uses gdmhroutines; .... function TgtkObject.Arc(DC: HDC; x,y,width,height : Integer; StartPoint, EndPoint : TPoint): Boolean; var Angle1, Angle2 : Extended; begin ArcRadialCoords2Angles(X,Y,X+Width,Y+Height,StartPoint.X, StartPoint.Y,EndPoint.X,EndPoint.Y,Angle1,Angle2); {Angle results are in 1/64's of a degree for compatibility w/X} Result := Arc(DC,x,y,width,height,Trunc(Angle1 / 4), Trunc(Angle2 / 4)); end; There are inconsistencies I haven't worked out in the conversion routines which cause results to be off in one direction or another by exactly 1 degree, though this may actually be a discrepency between Windows and GTK Arcs. I also have initial support for PolyBezier2Polyline since GDK doesn't directly support Beziers which could be used to add a PolyBezier routine. While I can't guarentee a lot on account of my schedule, I know a fair bit about GDK vs WinAPI drawing routines and am willing to submit stuff I already have written, modified for Lazarus. I feel this is one area that Lazarus has always been weak in, and since I couldn't really help out much anywhere else I'd be willing to give a shot at filling in at least some of the gaps. TTFN Andrew _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email