I have developed some new end point for links in SimpleGraph and I used to use CANVAS to draw them.
- Code: Select all
function DrawEndPoint(Canvas: TCanvas; const Pt: TPoint; const Angle: Double; Style: TLinkBeginEndStyle; Size: Integer): TPoint; virtual;
but in the new version, this has been changed with a function called PointStyleRect.
Now I am confused that I got error message that saying Undeclared indetifier: 'Canvas'
I am using this function to draw an arc with an Angle:
- Code: Select all
procedure PlotArc(const Canvas: TCanvas;
const Center: TPoint;
const Radius: Integer;
const StartAngle: Single;
const StopAngle: Single);
// This is a nested function for PlotArc.
function GetPositionForAngle(const Angle: Single): TPoint;
var
CosAngle: Extended;
SinAngle: Extended;
begin
SinCos(DegToRad(Angle), SinAngle, CosAngle);
Result.X := Round(Center.X + Radius * SinAngle);
Result.Y := Round(Center.Y - Radius * CosAngle);
end;
// Main part of PlotArc.
var
Index: Integer;
begin
with GetPositionForAngle(StartAngle) do
Canvas.MoveTo(X, Y);
for Index := Ceil(StartAngle) to Floor(StopAngle) do
with GetPositionForAngle(Index) do
Canvas.LineTo(X, Y);
with GetPositionForAngle(StopAngle) do
Canvas.LineTo(X, Y);
end;
and as you can see for that reason I need to get the handle of canvas to draw that arc. It was working fine it version 2 tho.
so would you please tell me how can I do that with the new version?