mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 02:59:21 +02:00
TAChart: Remove TOpenGLDrawer -> Graphics dependency
git-svn-id: trunk@29967 -
This commit is contained in:
parent
a40bfdfa55
commit
2c1e9b1a49
@ -47,7 +47,7 @@ begin
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
d := TOpenGLDrawer.Create(OpenGLControl1);
|
d := TOpenGLDrawer.Create;
|
||||||
Chart1.DisableRedrawing;
|
Chart1.DisableRedrawing;
|
||||||
Chart1.Title.Text.Text := 'OpenGL';
|
Chart1.Title.Text.Text := 'OpenGL';
|
||||||
Chart1.Draw(d, Rect(0, 0, OpenGLControl1.Width, OpenGLControl1.Height));
|
Chart1.Draw(d, Rect(0, 0, OpenGLControl1.Width, OpenGLControl1.Height));
|
||||||
|
@ -15,7 +15,7 @@ Authors: Alexander Klenin
|
|||||||
}
|
}
|
||||||
unit TADrawerAggPas;
|
unit TADrawerAggPas;
|
||||||
|
|
||||||
{$mode objfpc}
|
{$H+}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ type
|
|||||||
|
|
||||||
{ TAggPasDrawer }
|
{ TAggPasDrawer }
|
||||||
|
|
||||||
TAggPasDrawer = class(TBasicDrawer, IChartDrawer, ISimpleTextOut)
|
TAggPasDrawer = class(TBasicDrawer, IChartDrawer)
|
||||||
strict private
|
strict private
|
||||||
FCanvas: TAggLCLCanvas;
|
FCanvas: TAggLCLCanvas;
|
||||||
procedure SetBrush(ABrush: TFPCustomBrush);
|
procedure SetBrush(ABrush: TFPCustomBrush);
|
||||||
|
@ -15,13 +15,12 @@ Authors: Alexander Klenin
|
|||||||
}
|
}
|
||||||
unit TADrawerOpenGL;
|
unit TADrawerOpenGL;
|
||||||
|
|
||||||
{$mode objfpc}
|
{$H+}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FPCanvas, FPImage, OpenGLContext, GL, GLu, Glut,
|
Classes, FPCanvas, FPImage, GL, GLu, Glut, TADrawUtils;
|
||||||
TADrawUtils;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -30,7 +29,6 @@ type
|
|||||||
TOpenGLDrawer = class(TBasicDrawer, IChartDrawer)
|
TOpenGLDrawer = class(TBasicDrawer, IChartDrawer)
|
||||||
strict private
|
strict private
|
||||||
FBrushColor: TFPColor;
|
FBrushColor: TFPColor;
|
||||||
FContext: TOpenGLControl;
|
|
||||||
FFontColor: TFPColor;
|
FFontColor: TFPColor;
|
||||||
FPenColor: TFPColor;
|
FPenColor: TFPColor;
|
||||||
FPenWidth: Integer;
|
FPenWidth: Integer;
|
||||||
@ -45,7 +43,7 @@ type
|
|||||||
function SimpleTextExtent(const AText: String): TPoint; override;
|
function SimpleTextExtent(const AText: String): TPoint; override;
|
||||||
procedure SimpleTextOut(AX, AY: Integer; const AText: String); override;
|
procedure SimpleTextOut(AX, AY: Integer; const AText: String); override;
|
||||||
public
|
public
|
||||||
constructor Create(AContext: TOpenGLControl);
|
constructor Create;
|
||||||
public
|
public
|
||||||
procedure AddToFontOrientation(ADelta: Integer);
|
procedure AddToFontOrientation(ADelta: Integer);
|
||||||
procedure ClippingStart;
|
procedure ClippingStart;
|
||||||
@ -74,10 +72,11 @@ type
|
|||||||
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;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Graphics, TAChartUtils;
|
TAChartUtils;
|
||||||
|
|
||||||
procedure ChartGLColor(AColor: TFPColor);
|
procedure ChartGLColor(AColor: TFPColor);
|
||||||
begin
|
begin
|
||||||
@ -130,9 +129,8 @@ begin
|
|||||||
glDisable(GL_CLIP_PLANE3);
|
glDisable(GL_CLIP_PLANE3);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TOpenGLDrawer.Create(AContext: TOpenGLControl);
|
constructor TOpenGLDrawer.Create;
|
||||||
begin
|
begin
|
||||||
FContext := AContext;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOpenGLDrawer.Ellipse(AX1, AY1, AX2, AY2: Integer);
|
procedure TOpenGLDrawer.Ellipse(AX1, AY1, AX2, AY2: Integer);
|
||||||
@ -150,7 +148,7 @@ end;
|
|||||||
|
|
||||||
function TOpenGLDrawer.GetBrushColor: TChartColor;
|
function TOpenGLDrawer.GetBrushColor: TChartColor;
|
||||||
begin
|
begin
|
||||||
Result := FPColorToTColor(FBrushColor);
|
Result := FPColorToChartColor(FBrushColor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TOpenGLDrawer.GetFontAngle: Double;
|
function TOpenGLDrawer.GetFontAngle: Double;
|
||||||
@ -224,7 +222,7 @@ end;
|
|||||||
procedure TOpenGLDrawer.PrepareSimplePen(AColor: TChartColor);
|
procedure TOpenGLDrawer.PrepareSimplePen(AColor: TChartColor);
|
||||||
begin
|
begin
|
||||||
FPenWidth := 1;
|
FPenWidth := 1;
|
||||||
FPenColor := TColorToFPColor(ColorToRGB(AColor));
|
FPenColor := ChartColorToFPColor(AColor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOpenGLDrawer.RadialPie(
|
procedure TOpenGLDrawer.RadialPie(
|
||||||
@ -261,7 +259,7 @@ end;
|
|||||||
|
|
||||||
procedure TOpenGLDrawer.SetBrushColor(AColor: TChartColor);
|
procedure TOpenGLDrawer.SetBrushColor(AColor: TChartColor);
|
||||||
begin
|
begin
|
||||||
FBrushColor := TColorToFPColor(ColorToRGB(AColor));
|
FBrushColor := ChartColorToFPColor(AColor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOpenGLDrawer.SetBrushParams(
|
procedure TOpenGLDrawer.SetBrushParams(
|
||||||
@ -285,7 +283,7 @@ end;
|
|||||||
procedure TOpenGLDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
|
procedure TOpenGLDrawer.SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor);
|
||||||
begin
|
begin
|
||||||
Unused(AStyle);
|
Unused(AStyle);
|
||||||
FPenColor := TColorToFPColor(ColorToRGB(AColor));
|
FPenColor := ChartColorToFPColor(AColor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TOpenGLDrawer.SimpleTextExtent(const AText: String): TPoint;
|
function TOpenGLDrawer.SimpleTextExtent(const AText: String): TPoint;
|
||||||
|
@ -21,7 +21,7 @@ unit TADrawUtils;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, FPCanvas, FPImage, Graphics, SysUtils, Types;
|
Classes, FPCanvas, FPImage, Graphics, Types;
|
||||||
|
|
||||||
type
|
type
|
||||||
TChartColor = -$7FFFFFFF-1..$7FFFFFFF;
|
TChartColor = -$7FFFFFFF-1..$7FFFFFFF;
|
||||||
|
Loading…
Reference in New Issue
Block a user