diff --git a/components/aggpas/lazarus/example/unit2.pas b/components/aggpas/lazarus/example/unit2.pas index 475238d1e1..3a7d7d7181 100644 --- a/components/aggpas/lazarus/example/unit2.pas +++ b/components/aggpas/lazarus/example/unit2.pas @@ -83,6 +83,7 @@ begin Chord(145,10,165,30, 0,2700); Chord(170,10,190,30, 1000,2700); Chord(195,10,215,30, 205,5, 195,30); + Pie(220,10,240,30, 230,5, 220,30); s:='Font.Size='+IntToStr(Font.Size); GetTextSize(s,TxtW,TxtH); @@ -120,6 +121,7 @@ begin Chord(145,32,165,52, 0,2700); Chord(170,32,190,52, 1000,2700); Chord(195,32,215,52, 205,27, 195,52); + Pie(220,32,240,52, 230,27, 220,52); s:='Font.Size='+IntToStr(Font.Size); GetTextSize(s,TxtW,TxtH); diff --git a/components/aggpas/src/agg_lcl.pas b/components/aggpas/src/agg_lcl.pas index 06e8d39b0c..bbf44ac758 100644 --- a/components/aggpas/src/agg_lcl.pas +++ b/components/aggpas/src/agg_lcl.pas @@ -122,6 +122,8 @@ type procedure GradientFill(ARect: TRect; AStart, AStop: TColor; ADirection: TGradientDirection);// ToDo + procedure Pie(EllipseX1,EllipseY1,EllipseX2,EllipseY2, + StartX,StartY,EndX,EndY: Integer); virtual; procedure Polygon(const Points: array of TPoint; Winding: Boolean; StartIndex: Integer = 0; @@ -385,17 +387,11 @@ begin cy:=double(ATop+ABottom)/2+0.5; 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; Path.m_path.remove_all; - ar.Construct(cx ,cy ,rx ,ry ,endangle ,start ,false ); + ar.Construct(cx ,cy ,rx ,ry ,endangle ,start ,AngleLength<0 ); Path.m_path.add_path(@ar ,0 ,false ); AggClosePolygon; @@ -458,6 +454,51 @@ begin FillRect(ARect); end; +procedure TAggLCLCanvas.Pie(EllipseX1, EllipseY1, EllipseX2, EllipseY2, StartX, + StartY, EndX, EndY: Integer); +{ Use Pie to draw a filled Pie-shaped wedge on the canvas. The pie is part of + an ellipse between the points EllipseX1, EllipseY1, EllipseX2, EllipseY2. + The values StartX, StartY and EndX, EndY represent the starting and ending + radial-points between which the Bounding-Arc is drawn. +} +var + cx, cy, rx, ry: double; + StartAngle16deg, AngleLength16deg: extended; + da, startangle, endangle: Double; + + procedure AddArc(startangle, endangle: double); + var + a: Double; + begin + a:=startangle; + while a