mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-03 11:37:21 +01:00
TAChart: Implement AntialiasingMode in svg drawing back-end
git-svn-id: trunk@30412 -
This commit is contained in:
parent
01d9f547ad
commit
5ee5cbcdc7
@ -28,6 +28,7 @@ type
|
|||||||
|
|
||||||
TSVGDrawer = class(TBasicDrawer, IChartDrawer)
|
TSVGDrawer = class(TBasicDrawer, IChartDrawer)
|
||||||
strict private
|
strict private
|
||||||
|
FAntialiasingMode: TChartAntialiasingMode;
|
||||||
FBrushColor: TFPColor;
|
FBrushColor: TFPColor;
|
||||||
FClippingPathId: Integer;
|
FClippingPathId: Integer;
|
||||||
FFont: TFPCustomFont;
|
FFont: TFPCustomFont;
|
||||||
@ -80,6 +81,7 @@ type
|
|||||||
AStartAngle16Deg, AAngleLength16Deg: Integer);
|
AStartAngle16Deg, AAngleLength16Deg: Integer);
|
||||||
procedure Rectangle(const ARect: TRect);
|
procedure Rectangle(const ARect: TRect);
|
||||||
procedure Rectangle(AX1, AY1, AX2, AY2: Integer);
|
procedure Rectangle(AX1, AY1, AX2, AY2: Integer);
|
||||||
|
procedure SetAntialiasingMode(AValue: TChartAntialiasingMode);
|
||||||
procedure SetBrushColor(AColor: TChartColor);
|
procedure SetBrushColor(AColor: TChartColor);
|
||||||
procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor);
|
procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor);
|
||||||
procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
|
procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
|
||||||
@ -151,6 +153,7 @@ end;
|
|||||||
|
|
||||||
procedure TSVGDrawer.DrawingBegin(const ABoundingBox: TRect);
|
procedure TSVGDrawer.DrawingBegin(const ABoundingBox: TRect);
|
||||||
begin
|
begin
|
||||||
|
FAntialiasingMode := amDontCare;
|
||||||
with ABoundingBox do
|
with ABoundingBox do
|
||||||
WriteFmt(
|
WriteFmt(
|
||||||
'<svg ' +
|
'<svg ' +
|
||||||
@ -163,6 +166,8 @@ end;
|
|||||||
|
|
||||||
procedure TSVGDrawer.DrawingEnd;
|
procedure TSVGDrawer.DrawingEnd;
|
||||||
begin
|
begin
|
||||||
|
if FAntialiasingMode <> amDontCare then
|
||||||
|
WriteStr('</g>');
|
||||||
WriteStr('</svg>');
|
WriteStr('</svg>');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -275,6 +280,19 @@ begin
|
|||||||
Rectangle(Left, Top, Right, Bottom);
|
Rectangle(Left, Top, Right, Bottom);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSVGDrawer.SetAntialiasingMode(AValue: TChartAntialiasingMode);
|
||||||
|
const
|
||||||
|
AM_TO_CSS: array [amOn .. amOff] of String =
|
||||||
|
('geometricPrecision', 'crispEdges');
|
||||||
|
begin
|
||||||
|
if FAntialiasingMode = AValue then exit;
|
||||||
|
if FAntialiasingMode <> amDontCare then
|
||||||
|
WriteStr('</g>');
|
||||||
|
FAntialiasingMode := AValue;
|
||||||
|
if FAntialiasingMode <> amDontCare then
|
||||||
|
WriteFmt('<g style="shape-rendering: %s">',[AM_TO_CSS[FAntialiasingMode]]);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSVGDrawer.SetBrush(ABrush: TFPCustomBrush);
|
procedure TSVGDrawer.SetBrush(ABrush: TFPCustomBrush);
|
||||||
begin
|
begin
|
||||||
FBrushColor := ABrush.FPColor;
|
FBrushColor := ABrush.FPColor;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user