aggpas: started chord

git-svn-id: trunk@22965 -
This commit is contained in:
mattias 2009-12-04 15:48:16 +00:00
parent d973922915
commit 8dda7b592e
2 changed files with 46 additions and 5 deletions

View File

@ -77,8 +77,12 @@ begin
Ellipse(55,10,65,20);
//GradientFill(Rect(70,10,80,20),clRed,clBlue,gdVertical);
Frame(85,10,95,20);
Arc(100,10,110,20,0,2700);
Arc(115,10,125,20,1000,2700);
Arc(100,10,110,20, 0,2700);
Arc(115,10,125,20, 1000,2700);
Arc(130,10,140,20, 135,5, 130,20);
//Chord(145,10,150,20, 0,2700);
//Chord(155,10,165,20, 1000,2700);
//Chord(170,10,180,20, 175,5, 170,20);
s:='Font.Size='+IntToStr(Font.Size);
GetTextSize(s,TxtW,TxtH);
@ -108,8 +112,12 @@ begin
Ellipse(55,22,65,32);
GradientFill(Rect(70,22,80,32),clRed,clBlue,gdVertical);
Frame(85,22,95,32);
Arc(100,22,110,32,0,2700);
Arc(115,22,125,32,1000,2700);
Arc(100,22,110,32, 0,2700);
Arc(115,22,125,32, 1000,2700);
Arc(130,22,140,32, 135,15, 130,32);
//Chord(145,22,150,32, 0,2700);
//Chord(155,22,165,32, 1000,2700);
//Chord(170,22,180,32, 175,5, 170,20);
s:='Font.Size='+IntToStr(Font.Size);
GetTextSize(s,TxtW,TxtH);

View File

@ -12,7 +12,7 @@ uses
Windows ,
{$ENDIF}
Classes ,Graphics, LCLProc, IntfGraphics, GraphType, FPimage, FPCanvas,
agg_fpimage;
GraphMath, agg_fpimage;
type
@ -110,6 +110,8 @@ type
// extra drawing methods (there are more in the ancestor TFPCustomCanvas)
procedure Arc(ALeft, ATop, ARight, ABottom, StartAngle, AngleLength: Integer); virtual;
procedure Arc(ALeft, ATop, ARight, ABottom, SX, SY, EX, EY: Integer); virtual;
procedure Chord(ALeft, ATop, ARight, ABottom, StartAngle, AngleLength: Integer); virtual;
procedure Chord(ALeft, ATop, ARight, ABottom, SX, SY, EX, EY: Integer); virtual;
function LCLAngleToAggAngle(const angle: double): double;
procedure FillRect(const ARect: TRect); virtual; // no border
@ -294,6 +296,37 @@ end;
procedure TAggLCLCanvas.Arc(ALeft, ATop, ARight, ABottom, SX, SY, EX,
EY: Integer);
var
StartAngle: Extended;
AngleLength: Extended;
cx, cy, rx, ry, start, endangle, h: double;
begin
Coords2Angles(ALeft, ATop, ARight-ALeft, ABottom-ATop, SX, SY, EX, EY,
StartAngle, AngleLength);
if AngleLength=0 then exit;
cx:=double(ALeft+ARight)/2;
cy:=double(ATop+ABottom)/2;
rx:=double(ARight-ALeft)/2;
ry:=double(ABottom-ATop)/2;
// counter clockwise to clockwise
start:=LCLAngleToAggAngle(StartAngle+AngleLength);
endangle:=LCLAngleToAggAngle(StartAngle);
if AngleLength<0 then begin
h:=start;
start:=endangle;
endangle:=h;
end;
AggArc(cx,cy,rx,ry,start,endangle);
end;
procedure TAggLCLCanvas.Chord(ALeft, ATop, ARight, ABottom, StartAngle,
AngleLength: Integer);
begin
end;
procedure TAggLCLCanvas.Chord(ALeft, ATop, ARight, ABottom, SX, SY, EX,
EY: Integer);
begin
end;