mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-26 15:09:23 +02:00
aggpas: arc
git-svn-id: trunk@22963 -
This commit is contained in:
parent
48ba589092
commit
bc49063c1a
@ -77,8 +77,8 @@ 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,1000,2700);
|
||||
//Arc(115,10,125,20,0,2700);
|
||||
Arc(100,10,110,20,0,2700);
|
||||
Arc(115,10,125,20,1000,2700);
|
||||
|
||||
s:='Font.Size='+IntToStr(Font.Size);
|
||||
GetTextSize(s,TxtW,TxtH);
|
||||
@ -108,8 +108,8 @@ 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,1000,2700);
|
||||
//Arc(115,22,125,32,0,2700);
|
||||
Arc(100,22,110,32,0,2700);
|
||||
Arc(115,22,125,32,1000,2700);
|
||||
|
||||
s:='Font.Size='+IntToStr(Font.Size);
|
||||
GetTextSize(s,TxtW,TxtH);
|
||||
|
@ -573,7 +573,7 @@ type
|
||||
|
||||
procedure AggEllipse(const cx ,cy ,rx ,ry : double );
|
||||
|
||||
procedure AggArc (const cx ,cy ,rx ,ry ,start ,sweep : double ); // start: 0 at 3'o clock, clockwise in rad: 180deg = 1pi
|
||||
procedure AggArc (const cx ,cy ,rx ,ry ,start ,endangle : double ); // start: 0 at 3'o clock, clockwise in rad: 180deg = 1pi
|
||||
procedure AggStar(const cx, cy, r1, r2, startAngle: double; numRays: integer);
|
||||
|
||||
procedure AggCurve(const x1 ,y1 ,x2 ,y2 ,x3 ,y3 : double );
|
||||
@ -1948,13 +1948,13 @@ begin
|
||||
AggDrawPath(AGG_FillAndStroke );
|
||||
end;
|
||||
|
||||
procedure TAggFPCanvas.AggArc(const cx, cy, rx, ry, start, sweep: double);
|
||||
procedure TAggFPCanvas.AggArc(const cx, cy, rx, ry, start, endangle: double);
|
||||
var
|
||||
ar : agg_arc.arc;
|
||||
begin
|
||||
Path.m_path.remove_all;
|
||||
|
||||
ar.Construct(cx ,cy ,rx ,ry ,sweep ,start ,false );
|
||||
ar.Construct(cx ,cy ,rx ,ry ,endangle ,start ,false );
|
||||
|
||||
Path.m_path.add_path(@ar ,0 ,false );
|
||||
|
||||
|
@ -274,23 +274,22 @@ procedure TAggLCLCanvas.Arc(ALeft, ATop, ARight, ABottom,
|
||||
Zero degrees is at the 3'o clock position.
|
||||
}
|
||||
var
|
||||
cx, cy, rx, ry, start, sweep, h: double;
|
||||
cx, cy, rx, ry, start, endangle, h: double;
|
||||
begin
|
||||
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;
|
||||
if AngleLength>0 then begin
|
||||
// convert counter clockwise to clockwise
|
||||
start:=LCLAngleToAggAngle(StartAngle+AngleLength);
|
||||
sweep:=LCLAngleToAggAngle(AngleLength);
|
||||
end else begin
|
||||
// clockwise
|
||||
start:=LCLAngleToAggAngle(StartAngle);
|
||||
sweep:=LCLAngleToAggAngle(-AngleLength);
|
||||
// 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,sweep);
|
||||
AggArc(cx,cy,rx,ry,start,endangle);
|
||||
end;
|
||||
|
||||
procedure TAggLCLCanvas.Arc(ALeft, ATop, ARight, ABottom, SX, SY, EX,
|
||||
@ -304,7 +303,7 @@ function TAggLCLCanvas.LCLAngleToAggAngle(const angle: double): double;
|
||||
// LCL: counter clockwise, Agg: clockwise
|
||||
// full circle: LCL = 5760, Agg = 2*pi
|
||||
begin
|
||||
Result:=(angle * 2*pi) / 5760;
|
||||
Result:=2*pi* (1-(angle / 5760));
|
||||
end;
|
||||
|
||||
procedure TAggLCLCanvas.FillRect(const ARect: TRect);
|
||||
|
Loading…
Reference in New Issue
Block a user