mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 19:20:40 +02:00
TAChart: Add GetBrushColor, SetBrushColor and DrawLineDepth methods to the IChartDrawer interface
git-svn-id: trunk@29629 -
This commit is contained in:
parent
1c91f3de2d
commit
2d7dd017e5
@ -29,17 +29,19 @@ type
|
|||||||
procedure ClippingStart(const AClipRect: TRect);
|
procedure ClippingStart(const AClipRect: TRect);
|
||||||
procedure ClippingStop;
|
procedure ClippingStop;
|
||||||
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
||||||
|
function GetBrushColor: TChartColor;
|
||||||
function GetCanvas: TCanvas;
|
function GetCanvas: TCanvas;
|
||||||
function HasCanvas: Boolean;
|
function HasCanvas: Boolean;
|
||||||
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
||||||
procedure Line(const AP1, AP2: TPoint);
|
procedure Line(const AP1, AP2: TPoint);
|
||||||
procedure Polygon(const APoints: array of TPoint);
|
procedure Polygon(const APoints: array of TPoint); override;
|
||||||
procedure PrepareSimplePen(AColor: TChartColor);
|
procedure PrepareSimplePen(AColor: TChartColor);
|
||||||
procedure RadialPie(
|
procedure RadialPie(
|
||||||
AX1, AY1, AX2, AY2: Integer;
|
AX1, AY1, AX2, AY2: Integer;
|
||||||
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 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);
|
||||||
end;
|
end;
|
||||||
@ -83,6 +85,11 @@ begin
|
|||||||
FCanvas.FillRect(AX1, AY1, AX2, AY2);
|
FCanvas.FillRect(AX1, AY1, AX2, AY2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TAggPasDrawer.GetBrushColor: TChartColor;
|
||||||
|
begin
|
||||||
|
Result := FCanvas.Brush.Color;
|
||||||
|
end;
|
||||||
|
|
||||||
function TAggPasDrawer.GetCanvas: TCanvas;
|
function TAggPasDrawer.GetCanvas: TCanvas;
|
||||||
begin
|
begin
|
||||||
raise Exception.Create('TAggPasDrawer.GetCanvas');
|
raise Exception.Create('TAggPasDrawer.GetCanvas');
|
||||||
@ -153,6 +160,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TAggPasDrawer.SetBrushColor(AColor: TChartColor);
|
||||||
|
begin
|
||||||
|
FCanvas.Brush.Color := AColor;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TAggPasDrawer.SetBrushParams(
|
procedure TAggPasDrawer.SetBrushParams(
|
||||||
AStyle: TFPBrushStyle; AColor: TChartColor);
|
AStyle: TFPBrushStyle; AColor: TChartColor);
|
||||||
begin
|
begin
|
||||||
|
@ -88,7 +88,10 @@ type
|
|||||||
procedure ClippingStart(const AClipRect: TRect);
|
procedure ClippingStart(const AClipRect: TRect);
|
||||||
procedure ClippingStart;
|
procedure ClippingStart;
|
||||||
procedure ClippingStop;
|
procedure ClippingStop;
|
||||||
|
procedure DrawLineDepth(AX1, AY1, AX2, AY2, ADepth: Integer);
|
||||||
|
procedure DrawLineDepth(const AP1, AP2: TPoint; ADepth: Integer);
|
||||||
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
||||||
|
function GetBrushColor: TChartColor;
|
||||||
function GetCanvas: TCanvas;
|
function GetCanvas: TCanvas;
|
||||||
function HasCanvas: Boolean;
|
function HasCanvas: Boolean;
|
||||||
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
||||||
@ -100,7 +103,8 @@ 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 SetBrush(APen: TFPCustomBrush);
|
procedure SetBrushColor(AColor: TChartColor);
|
||||||
|
procedure SetBrush(ABrush: TFPCustomBrush);
|
||||||
procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor);
|
procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor);
|
||||||
procedure SetFont(AValue: TFPCustomFont);
|
procedure SetFont(AValue: TFPCustomFont);
|
||||||
procedure SetPen(APen: TFPCustomPen);
|
procedure SetPen(APen: TFPCustomPen);
|
||||||
@ -110,6 +114,7 @@ type
|
|||||||
function TextOut: TChartTextOut;
|
function TextOut: TChartTextOut;
|
||||||
|
|
||||||
property Brush: TFPCustomBrush write SetBrush;
|
property Brush: TFPCustomBrush write SetBrush;
|
||||||
|
property BrushColor: TChartColor read GetBrushColor write SetBrushColor;
|
||||||
property Canvas: TCanvas read GetCanvas;
|
property Canvas: TCanvas read GetCanvas;
|
||||||
property Font: TFPCustomFont write SetFont;
|
property Font: TFPCustomFont write SetFont;
|
||||||
property Pen: TFPCustomPen write SetPen;
|
property Pen: TFPCustomPen write SetPen;
|
||||||
@ -123,6 +128,9 @@ type
|
|||||||
procedure SimpleTextOut(AX, AY: Integer; const AText: String); virtual; abstract;
|
procedure SimpleTextOut(AX, AY: Integer; const AText: String); virtual; abstract;
|
||||||
function SimpleTextExtent(const AText: String): TPoint; virtual; abstract;
|
function SimpleTextExtent(const AText: String): TPoint; virtual; abstract;
|
||||||
public
|
public
|
||||||
|
procedure DrawLineDepth(AX1, AY1, AX2, AY2, ADepth: Integer);
|
||||||
|
procedure DrawLineDepth(const AP1, AP2: TPoint; ADepth: Integer);
|
||||||
|
procedure Polygon(const APoints: array of TPoint); virtual; abstract;
|
||||||
function TextExtent(const AText: String): TPoint;
|
function TextExtent(const AText: String): TPoint;
|
||||||
function TextExtent(AText: TStrings): TPoint;
|
function TextExtent(AText: TStrings): TPoint;
|
||||||
function TextOut: TChartTextOut;
|
function TextOut: TChartTextOut;
|
||||||
@ -147,17 +155,19 @@ type
|
|||||||
procedure ClippingStop;
|
procedure ClippingStop;
|
||||||
constructor Create(ACanvas: TCanvas);
|
constructor Create(ACanvas: TCanvas);
|
||||||
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
||||||
|
function GetBrushColor: TChartColor;
|
||||||
function GetCanvas: TCanvas;
|
function GetCanvas: TCanvas;
|
||||||
function HasCanvas: Boolean;
|
function HasCanvas: Boolean;
|
||||||
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
||||||
procedure Line(const AP1, AP2: TPoint);
|
procedure Line(const AP1, AP2: TPoint);
|
||||||
procedure Polygon(const APoints: array of TPoint);
|
procedure Polygon(const APoints: array of TPoint); override;
|
||||||
procedure PrepareSimplePen(AColor: TChartColor);
|
procedure PrepareSimplePen(AColor: TChartColor);
|
||||||
procedure RadialPie(
|
procedure RadialPie(
|
||||||
AX1, AY1, AX2, AY2: Integer;
|
AX1, AY1, AX2, AY2: Integer;
|
||||||
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 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);
|
||||||
end;
|
end;
|
||||||
@ -289,6 +299,19 @@ end;
|
|||||||
|
|
||||||
{ TFPCanvasDrawer }
|
{ TFPCanvasDrawer }
|
||||||
|
|
||||||
|
procedure TFPCanvasDrawer.DrawLineDepth(AX1, AY1, AX2, AY2, ADepth: Integer);
|
||||||
|
begin
|
||||||
|
DrawLineDepth(Point(AX1, AY1), Point(AX2, AY2), ADepth);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TFPCanvasDrawer.DrawLineDepth(const AP1, AP2: TPoint; ADepth: Integer);
|
||||||
|
var
|
||||||
|
d: TPoint;
|
||||||
|
begin
|
||||||
|
d := Point(ADepth, -ADepth);
|
||||||
|
Polygon([AP1, AP1 + d, AP2 + d, AP2]);
|
||||||
|
end;
|
||||||
|
|
||||||
function TFPCanvasDrawer.TextExtent(const AText: String): TPoint;
|
function TFPCanvasDrawer.TextExtent(const AText: String): TPoint;
|
||||||
var
|
var
|
||||||
sl: TStrings;
|
sl: TStrings;
|
||||||
@ -355,6 +378,11 @@ begin
|
|||||||
FCanvas.FillRect(AX1, AY1, AX2, AY2);
|
FCanvas.FillRect(AX1, AY1, AX2, AY2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCanvasDrawer.GetBrushColor: TChartColor;
|
||||||
|
begin
|
||||||
|
Result := FCanvas.Brush.Color;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCanvasDrawer.GetCanvas: TCanvas;
|
function TCanvasDrawer.GetCanvas: TCanvas;
|
||||||
begin
|
begin
|
||||||
Result := FCanvas;
|
Result := FCanvas;
|
||||||
@ -418,6 +446,11 @@ begin
|
|||||||
FCanvas.Brush.Assign(ABrush);
|
FCanvas.Brush.Assign(ABrush);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCanvasDrawer.SetBrushColor(AColor: TChartColor);
|
||||||
|
begin
|
||||||
|
FCanvas.Brush.Color := AColor;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCanvasDrawer.SetBrushParams(
|
procedure TCanvasDrawer.SetBrushParams(
|
||||||
AStyle: TFPBrushStyle; AColor: TChartColor);
|
AStyle: TFPBrushStyle; AColor: TChartColor);
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user