diff --git a/components/aggpas/src/agg_lcl.pas b/components/aggpas/src/agg_lcl.pas index ab3ce3cf95..09368b79c2 100644 --- a/components/aggpas/src/agg_lcl.pas +++ b/components/aggpas/src/agg_lcl.pas @@ -120,7 +120,18 @@ type procedure Frame(const ARect: TRect); virtual; // ToDo: border using brush procedure Frame(X1,Y1,X2,Y2: Integer); // ToDo: border using brush - procedure GradientFill(ARect: TRect; AStart, AStop: TColor; ADirection: TGradientDirection); + procedure GradientFill(ARect: TRect; AStart, AStop: TColor; ADirection: TGradientDirection);// ToDo + + procedure Polygon(const Points: array of TPoint; + Winding: Boolean; + StartIndex: Integer = 0; + NumPts: Integer = -1);// ToDo: winding + procedure Polygon(Points: PPoint; NumPts: Integer; + Winding: boolean = False); virtual;// ToDo: winding + procedure Polyline(const Points: array of TPoint; + StartIndex: Integer; + NumPts: Integer = -1); + procedure Polyline(Points: PPoint; NumPts: Integer); virtual; procedure TextRect(const ARect: TRect; X, Y: integer; const Text: string); function TextExtent(const Text: string): TSize; virtual; @@ -444,6 +455,104 @@ begin FillRect(ARect); end; +procedure TAggLCLCanvas.Polygon(const Points: array of TPoint; + Winding: Boolean; StartIndex: Integer; NumPts: Integer); +var + i: LongInt; + p: TPoint; +begin + if NumPts=0 then exit; + if StartIndex=high(Points) then exit; + if (NumPts<0) or (StartIndex+NumPts-1>high(Points)) then + NumPts:=High(Points)-StartIndex+1; + Path.m_path.remove_all; + i:=StartIndex; + p:=Points[i]; + Path.m_path.move_to(p.x+0.5 ,p.y+0.5 ); + inc(i); + dec(NumPts); + while NumPts>0 do begin + p:=points[i]; + Path.m_path.line_to(p.x+0.5,p.y+0.5); + inc(i); + dec(NumPts); + end; + AggClosePolygon; + AggDrawPath(AGG_FillOnly); +end; + +procedure TAggLCLCanvas.Polygon(Points: PPoint; NumPts: Integer; + Winding: boolean); +var + i: Integer; +begin + if NumPts<=1 then exit; + Path.m_path.remove_all; + i:=0; + Path.m_path.move_to(points[i].x+0.5 ,points[i].y+0.5 ); + inc(i); + while i=high(Points) then exit; + if (NumPts<0) or (StartIndex+NumPts-1>high(Points)) then + NumPts:=High(Points)-StartIndex+1; + Path.m_path.remove_all; + i:=StartIndex; + p:=Points[i]; + Path.m_path.move_to(p.x+0.5 ,p.y+0.5 ); + inc(i); + dec(NumPts); + while NumPts>0 do begin + p:=points[i]; + Path.m_path.line_to(p.x+0.5,p.y+0.5); + inc(i); + dec(NumPts); + end; + AggDrawPath(AGG_StrokeOnly ); +end; + +procedure TAggLCLCanvas.Polyline(Points: PPoint; NumPts: Integer); +var + i: Integer; +begin + if NumPts<=1 then exit; + Path.m_path.remove_all; + i:=0; + Path.m_path.move_to(points[i].x+0.5 ,points[i].y+0.5 ); + inc(i); + while i