mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 15:19:19 +02:00
TAChart: Improve synchronization in drawer demos
git-svn-id: trunk@29950 -
This commit is contained in:
parent
04831e21a5
commit
29546f3a08
@ -36,6 +36,7 @@ object Form1: TForm1
|
|||||||
'Standard'
|
'Standard'
|
||||||
)
|
)
|
||||||
Title.Visible = True
|
Title.Visible = True
|
||||||
|
OnAfterPaint = Chart1AfterPaint
|
||||||
Align = alClient
|
Align = alClient
|
||||||
Color = clMoneyGreen
|
Color = clMoneyGreen
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
|
@ -24,6 +24,7 @@ type
|
|||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
RandomChartSource1: TRandomChartSource;
|
RandomChartSource1: TRandomChartSource;
|
||||||
procedure cbAggPasClick(Sender: TObject);
|
procedure cbAggPasClick(Sender: TObject);
|
||||||
|
procedure Chart1AfterPaint(ASender: TChart);
|
||||||
procedure ChartPaint(
|
procedure ChartPaint(
|
||||||
ASender: TChart; const ARect: TRect; var ADoDefaultDrawing: Boolean);
|
ASender: TChart; const ARect: TRect; var ADoDefaultDrawing: Boolean);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
@ -51,6 +52,11 @@ begin
|
|||||||
Chart1.OnChartPaint := nil;
|
Chart1.OnChartPaint := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.Chart1AfterPaint(ASender: TChart);
|
||||||
|
begin
|
||||||
|
PaintBox1.Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.ChartPaint(ASender: TChart; const ARect: TRect;
|
procedure TForm1.ChartPaint(ASender: TChart; const ARect: TRect;
|
||||||
var ADoDefaultDrawing: Boolean);
|
var ADoDefaultDrawing: Boolean);
|
||||||
begin
|
begin
|
||||||
@ -78,9 +84,11 @@ procedure TForm1.PaintBox1Paint(Sender: TObject);
|
|||||||
begin
|
begin
|
||||||
FAggCanvas.Width := PaintBox1.Width;
|
FAggCanvas.Width := PaintBox1.Width;
|
||||||
FAggCanvas.Height := PaintBox1.Height;
|
FAggCanvas.Height := PaintBox1.Height;
|
||||||
|
Chart1.DisableRedrawing;
|
||||||
Chart1.Title.Text.Text := 'AggPas';
|
Chart1.Title.Text.Text := 'AggPas';
|
||||||
Chart1.Draw(TAggPasDrawer.Create(FAggCanvas), PaintBox1.Canvas.ClipRect);
|
Chart1.Draw(TAggPasDrawer.Create(FAggCanvas), PaintBox1.Canvas.ClipRect);
|
||||||
Chart1.Title.Text.Text := 'Standard';
|
Chart1.Title.Text.Text := 'Standard';
|
||||||
|
Chart1.EnableRedrawing;
|
||||||
FBmp.LoadFromIntfImage(FAggCanvas.Image.IntfImg);
|
FBmp.LoadFromIntfImage(FAggCanvas.Image.IntfImg);
|
||||||
PaintBox1.Canvas.Draw(0, 0, FBmp);
|
PaintBox1.Canvas.Draw(0, 0, FBmp);
|
||||||
end;
|
end;
|
||||||
|
@ -6,7 +6,6 @@ object Form1: TForm1
|
|||||||
Caption = 'Form1'
|
Caption = 'Form1'
|
||||||
ClientHeight = 319
|
ClientHeight = 319
|
||||||
ClientWidth = 684
|
ClientWidth = 684
|
||||||
OnCreate = FormCreate
|
|
||||||
LCLVersion = '0.9.31'
|
LCLVersion = '0.9.31'
|
||||||
object OpenGLControl1: TOpenGLControl
|
object OpenGLControl1: TOpenGLControl
|
||||||
Left = 344
|
Left = 344
|
||||||
@ -40,7 +39,9 @@ object Form1: TForm1
|
|||||||
'Standard'
|
'Standard'
|
||||||
)
|
)
|
||||||
Title.Visible = True
|
Title.Visible = True
|
||||||
|
OnAfterPaint = Chart1AfterPaint
|
||||||
Align = alLeft
|
Align = alLeft
|
||||||
|
Color = clSkyBlue
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
object Chart1LineSeries1: TLineSeries
|
object Chart1LineSeries1: TLineSeries
|
||||||
LinePen.Color = clBlue
|
LinePen.Color = clBlue
|
||||||
|
@ -18,10 +18,8 @@ type
|
|||||||
Chart1LineSeries1: TLineSeries;
|
Chart1LineSeries1: TLineSeries;
|
||||||
OpenGLControl1: TOpenGLControl;
|
OpenGLControl1: TOpenGLControl;
|
||||||
RandomChartSource1: TRandomChartSource;
|
RandomChartSource1: TRandomChartSource;
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure Chart1AfterPaint(ASender: TChart);
|
||||||
procedure OpenGLControl1Paint(Sender: TObject);
|
procedure OpenGLControl1Paint(Sender: TObject);
|
||||||
private
|
|
||||||
procedure OnAppIdle(Sender: TObject; var Done: Boolean);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -31,14 +29,8 @@ implementation
|
|||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
procedure TForm1.FormCreate(Sender: TObject);
|
procedure TForm1.Chart1AfterPaint(ASender: TChart);
|
||||||
begin
|
begin
|
||||||
Application.AddOnIdleHandler(@OnAppIdle);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TForm1.OnAppIdle(Sender: TObject; var Done: Boolean);
|
|
||||||
begin
|
|
||||||
Done:=false;
|
|
||||||
OpenGLControl1.Invalidate;
|
OpenGLControl1.Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -56,9 +48,11 @@ begin
|
|||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
d := TOpenGLDrawer.Create(OpenGLControl1);
|
d := TOpenGLDrawer.Create(OpenGLControl1);
|
||||||
|
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));
|
||||||
Chart1.Title.Text.Text := 'Standard';
|
Chart1.Title.Text.Text := 'Standard';
|
||||||
|
Chart1.EnableRedrawing;
|
||||||
|
|
||||||
OpenGLControl1.SwapBuffers;
|
OpenGLControl1.SwapBuffers;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user