[lazarus] Canvas, Arc/Chord/Pie etc. & Polybezier
Andrew Johnson
aj_genius at hotmail.com
Tue Aug 6 12:25:35 EDT 2002
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
More information about the Lazarus
mailing list