mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 11:01:20 +02:00
TAChart: Implement Polygon and Rectangle in fpvectorial drawing back-end. Update demo.
git-svn-id: trunk@30415 -
This commit is contained in:
parent
5bd27bfb26
commit
e6f053d841
@ -33,6 +33,10 @@ object Form1: TForm1
|
||||
LinePen.Color = clFuchsia
|
||||
Source = RandomChartSource1
|
||||
end
|
||||
object Chart1BarSeries1: TBarSeries
|
||||
BarBrush.Color = clRed
|
||||
Source = RandomChartSource1
|
||||
end
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
|
@ -18,6 +18,7 @@ type
|
||||
btnSVG: TButton;
|
||||
btnGCode: TButton;
|
||||
Chart1: TChart;
|
||||
Chart1BarSeries1: TBarSeries;
|
||||
Chart1LineSeries1: TLineSeries;
|
||||
Panel1: TPanel;
|
||||
RandomChartSource1: TRandomChartSource;
|
||||
|
@ -124,7 +124,14 @@ end;
|
||||
|
||||
procedure TFPVectorialDrawer.FillRect(AX1, AY1, AX2, AY2: Integer);
|
||||
begin
|
||||
// Not implemented.
|
||||
MoveTo(AX1, AY1);
|
||||
FCanvas.AddLineToPath(AX2, AY1);
|
||||
FCanvas.AddLineToPath(AX2, AY2);
|
||||
FCanvas.AddLineToPath(AX1, AY2);
|
||||
FCanvas.AddLineToPath(AX1, AY1);
|
||||
FCanvas.SetBrushStyle(bsClear);
|
||||
FCanvas.SetPenColor(FPenColor);
|
||||
FCanvas.EndPath();
|
||||
end;
|
||||
|
||||
function TFPVectorialDrawer.GetBrushColor: TChartColor;
|
||||
@ -140,7 +147,8 @@ end;
|
||||
procedure TFPVectorialDrawer.Line(AX1, AY1, AX2, AY2: Integer);
|
||||
begin
|
||||
FCanvas.StartPath(AX1, AY1);
|
||||
FCanvas.AddLineToPath(AX2, AY2, FPenColor);
|
||||
FCanvas.AddLineToPath(AX2, AY2);
|
||||
FCanvas.SetPenColor(FPenColor);
|
||||
FCanvas.EndPath();
|
||||
end;
|
||||
|
||||
@ -162,9 +170,16 @@ end;
|
||||
|
||||
procedure TFPVectorialDrawer.Polygon(
|
||||
const APoints: array of TPoint; AStartIndex, ANumPts: Integer);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
// Not implemented.
|
||||
Polyline(APoints, AStartIndex, ANumPts);
|
||||
MoveTo(APoints[AStartIndex]);
|
||||
for i := 1 to ANumPts - 1 do
|
||||
with APoints[i + AStartIndex] do
|
||||
FCanvas.AddLineToPath(X, Y);
|
||||
FCanvas.SetBrushColor(FBrushColor);
|
||||
FCanvas.SetPenColor(FPenColor);
|
||||
FCanvas.EndPath();
|
||||
end;
|
||||
|
||||
procedure TFPVectorialDrawer.Polyline(
|
||||
@ -175,7 +190,8 @@ begin
|
||||
MoveTo(APoints[AStartIndex]);
|
||||
for i := 1 to ANumPts - 1 do
|
||||
with APoints[i + AStartIndex] do
|
||||
FCanvas.AddLineToPath(X, Y, FPenColor);
|
||||
FCanvas.AddLineToPath(X, Y);
|
||||
FCanvas.SetPenColor(FPenColor);
|
||||
FCanvas.EndPath();
|
||||
end;
|
||||
|
||||
@ -192,12 +208,21 @@ end;
|
||||
|
||||
procedure TFPVectorialDrawer.Rectangle(AX1, AY1, AX2, AY2: Integer);
|
||||
begin
|
||||
// Not implemented.
|
||||
MoveTo(AX1, AY1);
|
||||
FCanvas.AddLineToPath(AX2, AY1);
|
||||
FCanvas.AddLineToPath(AX2, AY2);
|
||||
FCanvas.AddLineToPath(AX1, AY2);
|
||||
FCanvas.AddLineToPath(AX1, AY1);
|
||||
FCanvas.SetBrushColor(FBrushColor);
|
||||
FCanvas.SetBrushStyle(bsSolid);
|
||||
FCanvas.SetPenColor(FPenColor);
|
||||
FCanvas.EndPath();
|
||||
end;
|
||||
|
||||
procedure TFPVectorialDrawer.Rectangle(const ARect: TRect);
|
||||
begin
|
||||
// Not implemented.
|
||||
with ARect do
|
||||
Rectangle(Left, Top, Right, Bottom);
|
||||
end;
|
||||
|
||||
procedure TFPVectorialDrawer.SetBrush(ABrush: TFPCustomBrush);
|
||||
|
Loading…
Reference in New Issue
Block a user