TAChart: Support brush style, pen style and pen width in fpvectorial drawer

git-svn-id: trunk@38557 -
This commit is contained in:
ask 2012-09-07 13:07:09 +00:00
parent 2404c9e445
commit 0ee540a7df

View File

@ -34,8 +34,12 @@ type
FCanvas: TvVectorialPage; FCanvas: TvVectorialPage;
FFontSize: Integer; FFontSize: Integer;
FPenColor: TFPColor; FPenColor: TFPColor;
FPenStyle: TFPPenStyle;
FPenWidth: Integer;
procedure AddLine(AX, AY: Integer); procedure AddLine(AX, AY: Integer);
procedure ApplyBrush;
procedure ApplyPen;
function InvertY(AY: Integer): Integer; inline; function InvertY(AY: Integer): Integer; inline;
strict protected strict protected
function GetFontAngle: Double; override; function GetFontAngle: Double; override;
@ -92,6 +96,19 @@ begin
Unused(ADelta); Unused(ADelta);
end; end;
procedure TFPVectorialDrawer.ApplyBrush;
begin
FCanvas.SetBrushColor(FBrushColor);
FCanvas.SetBrushStyle(FBrushStyle);
end;
procedure TFPVectorialDrawer.ApplyPen;
begin
FCanvas.SetPenColor(FPenColor);
FCanvas.SetPenStyle(FPenStyle);
FCanvas.SetPenWidth(FPenWidth);
end;
procedure TFPVectorialDrawer.ClippingStart(const AClipRect: TRect); procedure TFPVectorialDrawer.ClippingStart(const AClipRect: TRect);
begin begin
Unused(AClipRect); // Not implemented. Unused(AClipRect); // Not implemented.
@ -188,8 +205,8 @@ begin
for i := 1 to ANumPts - 1 do for i := 1 to ANumPts - 1 do
with APoints[i + AStartIndex] do with APoints[i + AStartIndex] do
AddLine(X, Y); AddLine(X, Y);
FCanvas.SetBrushColor(FBrushColor); ApplyBrush;
FCanvas.SetPenColor(FPenColor); ApplyPen;
FCanvas.EndPath(); FCanvas.EndPath();
end; end;
@ -203,13 +220,15 @@ begin
for i := 1 to ANumPts - 1 do for i := 1 to ANumPts - 1 do
with APoints[i + AStartIndex] do with APoints[i + AStartIndex] do
AddLine(X, Y); AddLine(X, Y);
FCanvas.SetPenColor(FPenColor); ApplyPen;
FCanvas.EndPath(); FCanvas.EndPath();
end; end;
procedure TFPVectorialDrawer.PrepareSimplePen(AColor: TChartColor); procedure TFPVectorialDrawer.PrepareSimplePen(AColor: TChartColor);
begin begin
FPenColor := FChartColorToFPColorFunc(AColor); FPenColor := FChartColorToFPColorFunc(AColor);
FPenStyle := psSolid;
FPenWidth := 1;
end; end;
procedure TFPVectorialDrawer.RadialPie( procedure TFPVectorialDrawer.RadialPie(
@ -228,9 +247,8 @@ begin
AddLine(AX2, AY2); AddLine(AX2, AY2);
AddLine(AX1, AY2); AddLine(AX1, AY2);
AddLine(AX1, AY1); AddLine(AX1, AY1);
FCanvas.SetBrushColor(FBrushColor); ApplyBrush;
FCanvas.SetBrushStyle(FBrushStyle); ApplyPen;
FCanvas.SetPenColor(FPenColor);
FCanvas.EndPath(); FCanvas.EndPath();
end; end;
@ -266,12 +284,14 @@ end;
procedure TFPVectorialDrawer.SetPen(APen: TFPCustomPen); procedure TFPVectorialDrawer.SetPen(APen: TFPCustomPen);
begin begin
FPenColor := APen.FPColor; FPenColor := APen.FPColor;
FPenStyle := APen.Style;
FPenWidth := APen.Width;
end; end;
procedure TFPVectorialDrawer.SetPenParams( procedure TFPVectorialDrawer.SetPenParams(
AStyle: TFPPenStyle; AColor: TChartColor); AStyle: TFPPenStyle; AColor: TChartColor);
begin begin
Unused(AStyle); FPenStyle := AStyle;
FPenColor := FChartColorToFPColorFunc(AColor); FPenColor := FChartColorToFPColorFunc(AColor);
end; end;