mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 07:50:20 +02:00
TAChart: Add IChartDrawer.SetMonochromeColor procedure
git-svn-id: trunk@40049 -
This commit is contained in:
parent
bc9136c398
commit
fe0143e2cd
@ -207,7 +207,7 @@ begin
|
|||||||
if FXor then
|
if FXor then
|
||||||
Color := clWhite
|
Color := clWhite
|
||||||
else
|
else
|
||||||
Color := AColor;
|
Color := ColorOrMono(AColor);
|
||||||
Style := psSolid;
|
Style := psSolid;
|
||||||
if FXor then
|
if FXor then
|
||||||
Mode := pmXor
|
Mode := pmXor
|
||||||
@ -244,24 +244,28 @@ procedure TCanvasDrawer.SetBrush(ABrush: TFPCustomBrush);
|
|||||||
begin
|
begin
|
||||||
GetCanvas.Brush.Assign(ABrush);
|
GetCanvas.Brush.Assign(ABrush);
|
||||||
if FXor then
|
if FXor then
|
||||||
GetCanvas.Brush.Style := bsClear;
|
GetCanvas.Brush.Style := bsClear
|
||||||
|
else if FMonochromeColor <> clTAColor then
|
||||||
|
GetCanvas.Brush.Color := FMonochromeColor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCanvasDrawer.SetBrushColor(AColor: TChartColor);
|
procedure TCanvasDrawer.SetBrushColor(AColor: TChartColor);
|
||||||
begin
|
begin
|
||||||
GetCanvas.Brush.Color := AColor;
|
GetCanvas.Brush.Color := ColorOrMono(AColor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCanvasDrawer.SetBrushParams(
|
procedure TCanvasDrawer.SetBrushParams(
|
||||||
AStyle: TFPBrushStyle; AColor: TChartColor);
|
AStyle: TFPBrushStyle; AColor: TChartColor);
|
||||||
begin
|
begin
|
||||||
GetCanvas.Brush.Color := AColor;
|
GetCanvas.Brush.Color := ColorOrMono(AColor);
|
||||||
GetCanvas.Brush.Style := AStyle;
|
GetCanvas.Brush.Style := AStyle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCanvasDrawer.SetFont(AFont: TFPCustomFont);
|
procedure TCanvasDrawer.SetFont(AFont: TFPCustomFont);
|
||||||
begin
|
begin
|
||||||
GetCanvas.Font.Assign(AFont);
|
GetCanvas.Font.Assign(AFont);
|
||||||
|
if FMonochromeColor <> clTAColor then
|
||||||
|
GetCanvas.Font.Color := FMonochromeColor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCanvasDrawer.SetPen(APen: TFPCustomPen);
|
procedure TCanvasDrawer.SetPen(APen: TFPCustomPen);
|
||||||
@ -280,15 +284,18 @@ begin
|
|||||||
else
|
else
|
||||||
Pen.Width := APen.Width;
|
Pen.Width := APen.Width;
|
||||||
end
|
end
|
||||||
else
|
else begin
|
||||||
GetCanvas.Pen.Assign(APen);
|
GetCanvas.Pen.Assign(APen);
|
||||||
|
if FMonochromeColor <> clTAColor then
|
||||||
|
GetCanvas.Pen.Color := FMonochromeColor;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCanvasDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
|
procedure TCanvasDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
|
||||||
begin
|
begin
|
||||||
GetCanvas.Pen.Style := AStyle;
|
GetCanvas.Pen.Style := AStyle;
|
||||||
if not FXor then
|
if not FXor then
|
||||||
GetCanvas.Pen.Color := AColor;
|
GetCanvas.Pen.Color := ColorOrMono(AColor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCanvasDrawer.SetTransparency(ATransparency: TChartTransparency);
|
procedure TCanvasDrawer.SetTransparency(ATransparency: TChartTransparency);
|
||||||
|
@ -103,6 +103,7 @@ type
|
|||||||
procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor);
|
procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor);
|
||||||
procedure SetFont(AValue: TFPCustomFont);
|
procedure SetFont(AValue: TFPCustomFont);
|
||||||
procedure SetGetFontOrientationFunc(AValue: TGetFontOrientationFunc);
|
procedure SetGetFontOrientationFunc(AValue: TGetFontOrientationFunc);
|
||||||
|
procedure SetMonochromeColor(AColor: TChartColor);
|
||||||
procedure SetPen(APen: TFPCustomPen);
|
procedure SetPen(APen: TFPCustomPen);
|
||||||
procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
|
procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
|
||||||
procedure SetTransparency(ATransparency: TChartTransparency);
|
procedure SetTransparency(ATransparency: TChartTransparency);
|
||||||
@ -127,8 +128,10 @@ type
|
|||||||
strict protected
|
strict protected
|
||||||
FChartColorToFPColorFunc: TChartColorToFPColorFunc;
|
FChartColorToFPColorFunc: TChartColorToFPColorFunc;
|
||||||
FGetFontOrientationFunc: TGetFontOrientationFunc;
|
FGetFontOrientationFunc: TGetFontOrientationFunc;
|
||||||
|
FMonochromeColor: TChartColor;
|
||||||
FTransparency: TChartTransparency;
|
FTransparency: TChartTransparency;
|
||||||
FXor: Boolean;
|
FXor: Boolean;
|
||||||
|
function ColorOrMono(AColor: TChartColor): TChartColor; inline;
|
||||||
function GetFontAngle: Double; virtual; abstract;
|
function GetFontAngle: Double; virtual; abstract;
|
||||||
function SimpleTextExtent(const AText: String): TPoint; virtual; abstract;
|
function SimpleTextExtent(const AText: String): TPoint; virtual; abstract;
|
||||||
procedure SimpleTextOut(AX, AY: Integer; const AText: String); virtual; abstract;
|
procedure SimpleTextOut(AX, AY: Integer; const AText: String); virtual; abstract;
|
||||||
@ -148,6 +151,7 @@ type
|
|||||||
procedure SetAntialiasingMode(AValue: TChartAntialiasingMode);
|
procedure SetAntialiasingMode(AValue: TChartAntialiasingMode);
|
||||||
procedure SetDoChartColorToFPColorFunc(AValue: TChartColorToFPColorFunc);
|
procedure SetDoChartColorToFPColorFunc(AValue: TChartColorToFPColorFunc);
|
||||||
procedure SetGetFontOrientationFunc(AValue: TGetFontOrientationFunc);
|
procedure SetGetFontOrientationFunc(AValue: TGetFontOrientationFunc);
|
||||||
|
procedure SetMonochromeColor(AColor: TChartColor);
|
||||||
procedure SetTransparency(ATransparency: TChartTransparency);
|
procedure SetTransparency(ATransparency: TChartTransparency);
|
||||||
procedure SetXor(AXor: Boolean);
|
procedure SetXor(AXor: Boolean);
|
||||||
function TextExtent(const AText: String): TPoint;
|
function TextExtent(const AText: String): TPoint;
|
||||||
@ -288,10 +292,16 @@ end;
|
|||||||
|
|
||||||
{ TBasicDrawer }
|
{ TBasicDrawer }
|
||||||
|
|
||||||
|
function TBasicDrawer.ColorOrMono(AColor: TChartColor): TChartColor;
|
||||||
|
begin
|
||||||
|
Result := ColorDef(FMonochromeColor, AColor);
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TBasicDrawer.Create;
|
constructor TBasicDrawer.Create;
|
||||||
begin
|
begin
|
||||||
FChartColorToFPColorFunc := @ChartColorToFPColor;
|
FChartColorToFPColorFunc := @ChartColorToFPColor;
|
||||||
FGetFontOrientationFunc := @DummyGetFontOrientationFunc;
|
FGetFontOrientationFunc := @DummyGetFontOrientationFunc;
|
||||||
|
FMonochromeColor := clTAColor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBasicDrawer.DrawingBegin(const ABoundingBox: TRect);
|
procedure TBasicDrawer.DrawingBegin(const ABoundingBox: TRect);
|
||||||
@ -349,6 +359,11 @@ begin
|
|||||||
FGetFontOrientationFunc := AValue;
|
FGetFontOrientationFunc := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TBasicDrawer.SetMonochromeColor(AColor: TChartColor);
|
||||||
|
begin
|
||||||
|
FMonochromeColor := AColor;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TBasicDrawer.SetTransparency(ATransparency: TChartTransparency);
|
procedure TBasicDrawer.SetTransparency(ATransparency: TChartTransparency);
|
||||||
begin
|
begin
|
||||||
FTransparency := ATransparency;
|
FTransparency := ATransparency;
|
||||||
|
Loading…
Reference in New Issue
Block a user