From 227b97413959f42c585adaeb2d1260df26586a0c Mon Sep 17 00:00:00 2001 From: wp Date: Tue, 12 Jan 2021 16:44:38 +0000 Subject: [PATCH] TAChart: Chart drawers support setting pen width. git-svn-id: trunk@64380 - --- components/tachart/aggpas/tadraweraggpas.pas | 12 ++++++++++-- components/tachart/bgra/tadrawerbgra.pas | 11 +++++++++-- .../tachart/fpvectorial/tadrawerfpvectorial.pas | 12 ++++++++++-- components/tachart/opengl/tadraweropengl.pas | 12 ++++++++++-- components/tachart/tadrawercanvas.pas | 12 ++++++++++-- components/tachart/tadrawerfpcanvas.pas | 12 ++++++++++-- components/tachart/tadrawersvg.pas | 12 ++++++++++-- components/tachart/tadrawutils.pas | 3 ++- 8 files changed, 71 insertions(+), 15 deletions(-) diff --git a/components/tachart/aggpas/tadraweraggpas.pas b/components/tachart/aggpas/tadraweraggpas.pas index 9384deac73..31be708e8d 100644 --- a/components/tachart/aggpas/tadraweraggpas.pas +++ b/components/tachart/aggpas/tadraweraggpas.pas @@ -65,7 +65,8 @@ type procedure SetBrushColor(AColor: TChartColor); procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor); procedure SetPenColor(AColor: TChartColor); - procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor); + procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor; AWidth: Integer = 1); + procedure SetPenWidth(AWidth: Integer); end; implementation @@ -293,13 +294,20 @@ begin ApplyTransparency(ChartColorToFPColor(ColorOrMono(AColor))); end; -procedure TAggPasDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor); +procedure TAggPasDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor; + AWidth: Integer = 1); begin FCanvas.Pen.Style := AStyle; + FCanvas.Pen.Width := AWidth; FCanvas.Pen.FPColor := ApplyTransparency(ChartColorToFPColor(ColorOrMono(AColor))); end; +procedure TAggpasDrawer.SetPenWidth(AWidth: Integer); +begin + FCanvas.Pen.Width := AWidth; +end; + function TAggPasDrawer.SimpleTextExtent(const AText: String): TPoint; begin Result := FCanvas.TextExtent(AText); diff --git a/components/tachart/bgra/tadrawerbgra.pas b/components/tachart/bgra/tadrawerbgra.pas index c310608f79..b71338bb89 100644 --- a/components/tachart/bgra/tadrawerbgra.pas +++ b/components/tachart/bgra/tadrawerbgra.pas @@ -69,7 +69,8 @@ type procedure SetBrushColor(AColor: TChartColor); procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor); procedure SetPenColor(AColor: TChartColor); - procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor); + procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor; AWidth: Integer = 1); + procedure SetPenWidth(AWidth: Integer); procedure SetTransparency(ATransparency: TChartTransparency); end; @@ -318,13 +319,19 @@ begin end; procedure TBGRABitmapDrawer.SetPenParams( - AStyle: TFPPenStyle; AColor: TChartColor); + AStyle: TFPPenStyle; AColor: TChartColor; AWidth: Integer = 1); begin Canvas.Pen.Style := AStyle; + Canvas.Pen.Width := AWidth; Canvas.Pen.Color := ColorOrMono(AColor); Canvas.Pen.Opacity := Opacity; end; +procedure TBGRABitmapDrawer.SetPenWidth(AWidth: Integer); +begin + Canvas.Pen.Width := AWidth; +end; + procedure TBGRABitmapDrawer.SetTransparency(ATransparency: TChartTransparency); begin inherited; diff --git a/components/tachart/fpvectorial/tadrawerfpvectorial.pas b/components/tachart/fpvectorial/tadrawerfpvectorial.pas index 5c2b9efb15..4e6d54d8d1 100644 --- a/components/tachart/fpvectorial/tadrawerfpvectorial.pas +++ b/components/tachart/fpvectorial/tadrawerfpvectorial.pas @@ -80,7 +80,9 @@ type procedure SetBrushColor(AColor: TChartColor); procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor); procedure SetPenColor(AColor: TChartColor); - procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor); + procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor; AWidth: Integer = 1); + procedure SetPenWidth(AWidth: Integer); + end experimental; implementation @@ -427,12 +429,18 @@ begin end; procedure TFPVectorialDrawer.SetPenParams( - AStyle: TFPPenStyle; AColor: TChartColor); + AStyle: TFPPenStyle; AColor: TChartColor; AWidth: Integer = 1); begin FPenStyle := AStyle; + FPenWidth := AWidth; FPenColor := FChartColorToFPColorFunc(AColor); end; +procedure TFPVectorialDrawer.SetPenWidth(AWidth: Integer); +begin + FPenWidth := AWidth; +end; + function TFPVectorialDrawer.SimpleTextExtent(const AText: String): TPoint; begin if FFTFont <> nil then diff --git a/components/tachart/opengl/tadraweropengl.pas b/components/tachart/opengl/tadraweropengl.pas index dc4bccc159..d69bb7c49f 100644 --- a/components/tachart/opengl/tadraweropengl.pas +++ b/components/tachart/opengl/tadraweropengl.pas @@ -88,7 +88,8 @@ type procedure SetBrushColor(AColor: TChartColor); procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor); procedure SetPenColor(AColor: TChartColor); - procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor); + procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor; AWidth: Integer = 1); + procedure SetPenWidth(AWidth: Integer); procedure SetTransparency(ATransparency: TChartTransparency); end; @@ -424,13 +425,20 @@ begin FPenColor := FChartColorToFPColorFunc(AColor); end; -procedure TOpenGLDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor); +procedure TOpenGLDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor; + AWidth: Integer = 1); begin FPenStyle := AStyle; + FPenWidth := AWidth; FPenColor := FChartColorToFPColorFunc(AColor); ChartGLPenStyle(AStyle); end; +procedure TOpenGLDrawer.SetPenWidth(AWidth: Integer); +begin + FPenWidth := AWidth; +end; + procedure TOpenGLDrawer.SetTransparency(ATransparency: TChartTransparency); begin inherited; diff --git a/components/tachart/tadrawercanvas.pas b/components/tachart/tadrawercanvas.pas index 5f383aa079..f3f745a0f0 100644 --- a/components/tachart/tadrawercanvas.pas +++ b/components/tachart/tadrawercanvas.pas @@ -76,7 +76,8 @@ type procedure SetBrushColor(AColor: TChartColor); procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor); procedure SetPenColor(AColor: TChartColor); - procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor); + procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor; AWidth: Integer = 1); + procedure SetPenWidth(AWidth: Integer); procedure SetTransparency(ATransparency: TChartTransparency); end; @@ -430,13 +431,20 @@ begin GetCanvas.Pen.Color := ColorOrMono(AColor); end; -procedure TCanvasDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor); +procedure TCanvasDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor; + AWidth: Integer = 1); begin GetCanvas.Pen.Style := AStyle; + GetCanvas.Pen.Width := AWidth; if not FXor then GetCanvas.Pen.Color := ColorOrMono(AColor); end; +procedure TCanvasDrawer.SetPenWidth(AWidth: Integer); +begin + GetCanvas.Pen.Width := AWidth; +end; + procedure TCanvasDrawer.SetTransparency(ATransparency: TChartTransparency); function FillAlpha(AAlpha: Byte): Byte; diff --git a/components/tachart/tadrawerfpcanvas.pas b/components/tachart/tadrawerfpcanvas.pas index 0256354ba2..2dd1fbb00a 100644 --- a/components/tachart/tadrawerfpcanvas.pas +++ b/components/tachart/tadrawerfpcanvas.pas @@ -78,7 +78,8 @@ type procedure SetBrushColor(AColor: TChartColor); procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor); procedure SetPenColor(AColor: TChartColor); - procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor); + procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor; AWidth: Integer = 1); + procedure SetPenWidth(AWidth: Integer); end; implementation @@ -336,10 +337,17 @@ begin FCanvas.Pen.FPColor := FChartColorToFPColorFunc(AColor); end; -procedure TFPCanvasDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor); +procedure TFPCanvasDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor; + AWidth: Integer = 1); begin FCanvas.Pen.Style := AStyle; FCanvas.Pen.FPColor := FChartColorToFPColorFunc(AColor); + FCanvas.Pen.Width := AWidth; +end; + +procedure TFPCanvasDrawer.SetPenWidth(AWidth: Integer); +begin + FCanvas.Pen.Width := AWidth; end; function TFPCanvasDrawer.SimpleTextExtent(const AText: String): TPoint; diff --git a/components/tachart/tadrawersvg.pas b/components/tachart/tadrawersvg.pas index ff3bd25f0f..d2784f99b1 100644 --- a/components/tachart/tadrawersvg.pas +++ b/components/tachart/tadrawersvg.pas @@ -90,7 +90,8 @@ type procedure SetBrushColor(AColor: TChartColor); procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor); procedure SetPenColor(AColor: TChartColor); - procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor); + procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor; AWidth: Integer = 1); + procedure SetPenWidth(AWidth: Integer); end; @@ -515,10 +516,17 @@ begin FPen.FPColor := FChartColorToFPColorFunc(ColorOrMono(AColor)); end; -procedure TSVGDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor); +procedure TSVGDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor; + AWidth: Integer = 1); begin FPen.FPColor := FChartColorToFPColorFunc(ColorOrMono(AColor)); FPen.Style := AStyle; + FPen.Width := AWidth; +end; + +procedure TSVGDrawer.SetPenWidth(AWidth: Integer); +begin + FPen.Width := AWidth; end; function TSVGDrawer.SimpleTextExtent(const AText: String): TPoint; diff --git a/components/tachart/tadrawutils.pas b/components/tachart/tadrawutils.pas index 6ca7a3d684..5fb88bc9df 100644 --- a/components/tachart/tadrawutils.pas +++ b/components/tachart/tadrawutils.pas @@ -114,7 +114,8 @@ type procedure SetMonochromeColor(AColor: TChartColor); procedure SetPen(APen: TFPCustomPen); procedure SetPenColor(AColor: TChartColor); - procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor); + procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor; AWidth: Integer = 1); + procedure SetPenWidth(AWidth: Integer); function GetRightToLeft: Boolean; procedure SetRightToLeft(AValue: Boolean); procedure SetTransparency(ATransparency: TChartTransparency);