TAChart: Implement in drawing backends methods to access pen color only.

git-svn-id: trunk@60768 -
This commit is contained in:
wp 2019-03-25 12:34:17 +00:00
parent b72b08174e
commit 4ef73c26d0
10 changed files with 102 additions and 7 deletions

View File

@ -45,6 +45,7 @@ type
function GetFontName: String; override;
function GetFontSize: Integer; override;
function GetFontStyle: TChartFontStyles; override;
function GetPenColor: TChartColor;
procedure Line(AX1, AY1, AX2, AY2: Integer);
procedure Line(const AP1, AP2: TPoint);
procedure LineTo(AX, AY: Integer); override;
@ -63,6 +64,7 @@ type
procedure ResetFont;
procedure SetBrushColor(AColor: TChartColor);
procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor);
procedure SetPenColor(AColor: TChartColor);
procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
end;
@ -155,6 +157,11 @@ begin
if FCanvas.Font.StrikeThrough then Include(Result, cfsStrikeout);
end;
function TAggPasDrawer.GetPenColor: TChartColor;
begin
Result := FCanvas.Pen.Color;
end;
procedure TAggPasDrawer.Line(AX1, AY1, AX2, AY2: Integer);
begin
FCanvas.Line(AX1, AY1, AX2, AY2);
@ -280,6 +287,12 @@ begin
FCanvas.Pen.FPColor := ApplyTransparency(FPColorOrMono(APen.FPColor));
end;
procedure TAggPasDrawer.SetPenColor(AColor: TChartColor);
begin
FCanvas.Pen.FPColor :=
ApplyTransparency(ChartColorToFPColor(ColorOrMono(AColor)));
end;
procedure TAggPasDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
begin
FCanvas.Pen.Style := AStyle;

View File

@ -7,7 +7,7 @@ object Form1: TForm1
ClientHeight = 342
ClientWidth = 422
Position = poScreenCenter
LCLVersion = '1.9.0.0'
LCLVersion = '2.1.0.0'
object Chart1: TChart
Left = 0
Height = 306
@ -22,6 +22,7 @@ object Form1: TForm1
Marks.LabelFont.Name = 'Arial Narrow'
Marks.LabelFont.Pitch = fpVariable
Marks.LabelFont.Quality = fqDraft
Marks.LabelBrush.Style = bsClear
Minors = <>
Title.LabelFont.CharSet = ANSI_CHARSET
Title.LabelFont.Color = clRed
@ -33,6 +34,7 @@ object Form1: TForm1
Title.LabelFont.Style = [fsItalic]
Title.Visible = True
Title.Caption = 'y axis'
Title.LabelBrush.Style = bsClear
end
item
Grid.Color = clSilver
@ -42,6 +44,7 @@ object Form1: TForm1
Marks.LabelFont.Name = 'Arial Narrow'
Marks.LabelFont.Pitch = fpVariable
Marks.LabelFont.Quality = fqDraft
Marks.LabelBrush.Style = bsClear
Minors = <>
Title.LabelFont.CharSet = ANSI_CHARSET
Title.LabelFont.Color = clGreen
@ -52,6 +55,7 @@ object Form1: TForm1
Title.LabelFont.Style = [fsItalic]
Title.Visible = True
Title.Caption = 'x axis'
Title.LabelBrush.Style = bsClear
end>
BackColor = clWhite
Foot.Alignment = taLeftJustify
@ -82,7 +86,8 @@ object Form1: TForm1
Title.Visible = True
Align = alClient
object Chart1LineSeries1: TLineSeries
LinePen.Color = clFuchsia
LinePen.Color = clBlue
LinePen.Width = 2
Source = RandomChartSource1
end
object Chart1BarSeries1: TBarSeries

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<ProjectOptions BuildModesCount="1">
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<Flags>
@ -9,7 +9,6 @@
<MainUnitHasTitleStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
</General>
<i18n>
@ -18,7 +17,7 @@
<MacroValues Count="1">
<Macro1 Name="LCLWidgetType" Value="nogui"/>
</MacroValues>
<BuildModes Count="1">
<BuildModes>
<Item1 Name="Default" Default="True"/>
<SharedMatrixOptions Count="1">
<Item1 ID="909616661520" Modes="Default" Type="IDEMacro" MacroName="LCLWidgetType" Value="nogui"/>
@ -60,6 +59,9 @@
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<UseExternalDbgSyms Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>

View File

@ -60,6 +60,7 @@ type
function GetFontName: String; override;
function GetFontSize: Integer; override;
function GetFontStyle: TChartFontStyles; override;
function GetPenColor: TChartColor;
procedure Line(AX1, AY1, AX2, AY2: Integer);
procedure Line(const AP1, AP2: TPoint); overload;
procedure LineTo(AX, AY: Integer); override;
@ -78,6 +79,7 @@ type
procedure ResetFont;
procedure SetBrushColor(AColor: TChartColor);
procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor);
procedure SetPenColor(AColor: TChartColor);
procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
end experimental;
@ -209,6 +211,11 @@ begin
if FFont.StrikeThrough then Include(Result, cfsStrikeout);
end;
function TFPVectorialDrawer.GetPenColor: TChartColor;
begin
Result := FPColorToChartColor(FPenColor);
end;
function TFPVectorialDrawer.InvertY(AY: Integer): Integer;
begin
with FBoundingBox do
@ -414,6 +421,11 @@ begin
FPenWidth := APen.Width;
end;
procedure TFPVectorialDrawer.SetPenColor(AColor: TChartColor);
begin
FPenColor := FChartColorToFPColorFunc(AColor);
end;
procedure TFPVectorialDrawer.SetPenParams(
AStyle: TFPPenStyle; AColor: TChartColor);
begin

View File

@ -48,6 +48,7 @@ type
function GetFontName: String; override;
function GetFontSize: Integer; override;
function GetFontStyle: TChartFontStyles; override;
function GetPenColor: TChartColor;
procedure Line(AX1, AY1, AX2, AY2: Integer);
procedure Line(const AP1, AP2: TPoint);
procedure LineTo(AX, AY: Integer); override;
@ -67,6 +68,7 @@ type
procedure ResetFont;
procedure SetBrushColor(AColor: TChartColor);
procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor);
procedure SetPenColor(AColor: TChartColor);
procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
procedure SetTransparency(ATransparency: TChartTransparency);
end;
@ -165,6 +167,11 @@ begin
Result := TChartFontStyles(Canvas.Font.Style);
end;
function TBGRABitmapDrawer.GetPenColor: TChartColor;
begin
Result := TChartColor(Canvas.Pen.Color);
end;
procedure TBGRABitmapDrawer.Line(AX1, AY1, AX2, AY2: Integer);
begin
Canvas.MoveTo(AX1, AY1);
@ -305,6 +312,11 @@ begin
end;
end;
procedure TBGRABitmapDrawer.SetPenColor(AColor: TChartColor);
begin
Canvas.Pen.Color := ColorOrMono(AColor);
end;
procedure TBGRABitmapDrawer.SetPenParams(
AStyle: TFPPenStyle; AColor: TChartColor);
begin

View File

@ -54,6 +54,7 @@ type
function GetFontName: String; override;
function GetFontSize: Integer; override;
function GetFontStyle: TChartFontStyles; override;
function GetPenColor: TChartColor;
procedure Line(AX1, AY1, AX2, AY2: Integer);
procedure Line(const AP1, AP2: TPoint);
procedure LineTo(AX, AY: Integer); override;
@ -74,6 +75,7 @@ type
procedure SetAntialiasingMode(AValue: TChartAntialiasingMode);
procedure SetBrushColor(AColor: TChartColor);
procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor);
procedure SetPenColor(AColor: TChartColor);
procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
procedure SetTransparency(ATransparency: TChartTransparency);
end;
@ -205,6 +207,11 @@ begin
Result := TChartFontStyles(GetCanvas.Font.Style);
end;
function TCanvasDrawer.GetPenColor: TChartColor;
begin
Result := GetCanvas.Pen.Color;
end;
procedure TCanvasDrawer.Line(AX1, AY1, AX2, AY2: Integer);
begin
GetCanvas.Line(AX1, AY1, AX2, AY2);
@ -417,6 +424,12 @@ begin
end;
end;
procedure TCanvasDrawer.SetPenColor(AColor: TChartColor);
begin
if not FXor then
GetCanvas.Pen.Color := ColorOrMono(AColor);
end;
procedure TCanvasDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
begin
GetCanvas.Pen.Style := AStyle;

View File

@ -58,6 +58,7 @@ type
function GetFontName: String; override;
function GetFontSize: Integer; override;
function GetFontStyle: TChartFontStyles; override;
function GetPenColor: TChartColor;
procedure Line(AX1, AY1, AX2, AY2: Integer);
procedure Line(const AP1, AP2: TPoint);
procedure LineTo(AX, AY: Integer); override;
@ -76,6 +77,7 @@ type
procedure ResetFont;
procedure SetBrushColor(AColor: TChartColor);
procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor);
procedure SetPenColor(AColor: TChartColor);
procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
end;
@ -209,6 +211,11 @@ begin
if FCanvas.Font.Strikethrough then Include(Result, cfsStrikeout);
end;
function TFPCanvasDrawer.GetPenColor: TChartColor;
begin
Result := FPColorToChartColor(FCanvas.Pen.FPColor);
end;
procedure TFPCanvasDrawer.Line(AX1, AY1, AX2, AY2: Integer);
begin
FCanvas.Line(AX1, AY1, AX2, AY2);
@ -324,6 +331,11 @@ begin
AssignFPCanvasHelper(FCanvas.Pen, APen);
end;
procedure TFPCanvasDrawer.SetPenColor(AColor: TChartColor);
begin
FCanvas.Pen.FPColor := FChartColorToFPColorFunc(AColor);
end;
procedure TFPCanvasDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
begin
FCanvas.Pen.Style := AStyle;

View File

@ -67,6 +67,7 @@ type
function GetFontName: String; override;
function GetFontSize: Integer; override;
function GetFontStyle: TChartFontStyles; override;
function GetPenColor: TChartColor;
procedure Line(AX1, AY1, AX2, AY2: Integer);
procedure Line(const AP1, AP2: TPoint);
procedure LineTo(AX, AY: Integer); override;
@ -86,6 +87,7 @@ type
procedure SetAntialiasingMode(AValue: TChartAntialiasingMode);
procedure SetBrushColor(AColor: TChartColor);
procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor);
procedure SetPenColor(AColor: TChartColor);
procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
procedure SetTransparency(ATransparency: TChartTransparency);
end;
@ -246,6 +248,11 @@ begin
Result := FFontStyle;
end;
function TOpenGLDrawer.GetPenColor: TChartColor;
begin
Result := FPColorToChartColor(FPenColor);
end;
procedure TOpenGLDrawer.InternalPolyline(
const APoints: array of TPoint; AStartIndex, ANumPts, AMode: Integer);
var
@ -412,6 +419,11 @@ begin
ChartGLPenStyle(FPenStyle);
end;
procedure TOpenGLDrawer.SetPenColor(AColor: TChartColor);
begin
FPenColor := FChartColorToFPColorFunc(AColor);
end;
procedure TOpenGLDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
begin
FPenStyle := AStyle;

View File

@ -68,6 +68,7 @@ type
function GetFontName: String; override;
function GetFontSize: Integer; override;
function GetFontStyle: TChartFontStyles; override;
function GetPenColor: TChartColor;
procedure Line(AX1, AY1, AX2, AY2: Integer);
procedure Line(const AP1, AP2: TPoint);
procedure LineTo(AX, AY: Integer); override;
@ -88,6 +89,7 @@ type
procedure SetAntialiasingMode(AValue: TChartAntialiasingMode);
procedure SetBrushColor(AColor: TChartColor);
procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor);
procedure SetPenColor(AColor: TChartColor);
procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
end;
@ -291,6 +293,11 @@ begin
if FFont.StrikeoutDecoration then Include(Result, cfsStrikeout);
end;
function TSVGDrawer.GetPenColor: TChartColor;
begin
Result := FPColorToChartColor(FPen.FPColor);
end;
procedure TSVGDrawer.Line(AX1, AY1, AX2, AY2: Integer);
begin
WriteFmt(
@ -503,6 +510,11 @@ begin
FPen.Width := APen.Width;
end;
procedure TSVGDrawer.SetPenColor(AColor: TChartColor);
begin
FPen.FPColor := FChartColorToFPColorFunc(ColorOrMono(AColor));
end;
procedure TSVGDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
begin
FPen.FPColor := FChartColorToFPColorFunc(ColorOrMono(AColor));

View File

@ -83,6 +83,7 @@ type
function GetFontName: String;
function GetFontSize: Integer;
function GetFontStyle: TChartFontStyles;
function GetPenColor: TChartColor;
procedure SetDoChartColorToFPColorFunc(AValue: TChartColorToFPColorFunc);
procedure Line(AX1, AY1, AX2, AY2: Integer);
procedure Line(const AP1, AP2: TPoint);
@ -105,13 +106,14 @@ type
procedure ResetFont;
function Scale(ADistance: Integer): Integer;
procedure SetAntialiasingMode(AValue: TChartAntialiasingMode);
procedure SetBrushColor(AColor: TChartColor);
procedure SetBrush(ABrush: TFPCustomBrush);
procedure SetBrushColor(AColor: TChartColor);
procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor);
procedure SetFont(AValue: TFPCustomFont);
procedure SetGetFontOrientationFunc(AValue: TGetFontOrientationFunc);
procedure SetMonochromeColor(AColor: TChartColor);
procedure SetPen(APen: TFPCustomPen);
procedure SetPenColor(AColor: TChartColor);
procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
function GetRightToLeft: Boolean;
procedure SetRightToLeft(AValue: Boolean);