TAChart: Support monochrome mode in svg drawing back-end

git-svn-id: trunk@40091 -
This commit is contained in:
ask 2013-01-31 09:25:00 +00:00
parent 9bf682d41a
commit 6cd1638f18
2 changed files with 17 additions and 6 deletions

View File

@ -277,7 +277,7 @@ end;
procedure TSVGDrawer.PrepareSimplePen(AColor: TChartColor);
begin
FPen.FPColor := FChartColorToFPColorFunc(AColor);
FPen.FPColor := FChartColorToFPColorFunc(ColorOrMono(AColor));
FPen.Style := psSolid;
FPen.Width := 1;
end;
@ -323,36 +323,38 @@ end;
procedure TSVGDrawer.SetBrush(ABrush: TFPCustomBrush);
begin
FBrushColor := ABrush.FPColor;
FBrushColor := FPColorOrMono(ABrush.FPColor);
end;
procedure TSVGDrawer.SetBrushColor(AColor: TChartColor);
begin
FBrushColor := FChartColorToFPColorFunc(AColor);
FBrushColor := FChartColorToFPColorFunc(ColorOrMono(AColor));
end;
procedure TSVGDrawer.SetBrushParams(
AStyle: TFPBrushStyle; AColor: TChartColor);
begin
FBrushColor := FChartColorToFPColorFunc(AColor);
FBrushColor := FChartColorToFPColorFunc(ColorOrMono(AColor));
Unused(AStyle);
end;
procedure TSVGDrawer.SetFont(AFont: TFPCustomFont);
begin
FFont := AFont;
if FMonochromeColor <> clTAColor then
FFont.FPColor := FChartColorToFPColorFunc(FMonochromeColor);
end;
procedure TSVGDrawer.SetPen(APen: TFPCustomPen);
begin
FPen.FPColor := APen.FPColor;
FPen.FPColor := FPColorOrMono(APen.FPColor);
FPen.Style := APen.Style;
FPen.Width := APen.Width;
end;
procedure TSVGDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
begin
FPen.FPColor := FChartColorToFPColorFunc(AColor);
FPen.FPColor := FChartColorToFPColorFunc(ColorOrMono(AColor));
FPen.Style := AStyle;
end;

View File

@ -131,6 +131,7 @@ type
FTransparency: TChartTransparency;
FXor: Boolean;
function ColorOrMono(AColor: TChartColor): TChartColor; inline;
function FPColorOrMono(const AColor: TFPColor): TFPColor; inline;
function GetFontAngle: Double; virtual; abstract;
function SimpleTextExtent(const AText: String): TPoint; virtual; abstract;
procedure SimpleTextOut(AX, AY: Integer; const AText: String); virtual; abstract;
@ -327,6 +328,14 @@ begin
Polygon([AP1, AP1 + d, AP2 + d, AP2], 0, 4);
end;
function TBasicDrawer.FPColorOrMono(const AColor: TFPColor): TFPColor;
begin
if FMonochromeColor = clTAColor then
Result := AColor
else
Result := FChartColorToFPColorFunc(FMonochromeColor);
end;
procedure TBasicDrawer.LineTo(const AP: TPoint);
begin
LineTo(AP.X, AP.Y)