aggpas: added example for comparing LCL/aggpas comparison

git-svn-id: trunk@22117 -
This commit is contained in:
mattias 2009-10-12 15:12:28 +00:00
parent 78a617c4e2
commit 157277fda7
6 changed files with 192 additions and 0 deletions

5
.gitattributes vendored
View File

@ -85,9 +85,14 @@ components/aggpas/lazarus/aggpaslcl.lpk svneol=native#text/plain
components/aggpas/lazarus/example/AggPasInLCLDemo1.lpi svneol=native#text/plain
components/aggpas/lazarus/example/AggPasInLCLDemo1.lpr svneol=native#text/plain
components/aggpas/lazarus/example/AggPasInLCLDemo1.lrs svneol=native#text/plain
components/aggpas/lazarus/example/AggPasInLCLDemo2.lpi svneol=native#text/plain
components/aggpas/lazarus/example/AggPasInLCLDemo2.lpr svneol=native#text/plain
components/aggpas/lazarus/example/unit1.lfm svneol=native#text/plain
components/aggpas/lazarus/example/unit1.lrs svneol=native#text/plain
components/aggpas/lazarus/example/unit1.pas svneol=native#text/plain
components/aggpas/lazarus/example/unit2.lfm svneol=native#text/plain
components/aggpas/lazarus/example/unit2.lrs svneol=native#text/plain
components/aggpas/lazarus/example/unit2.pas svneol=native#text/pascal
components/aggpas/line_patterns.dpr svneol=native#text/plain
components/aggpas/lion.dpr svneol=native#text/plain
components/aggpas/lion_lens.dpr svneol=native#text/plain

View File

@ -0,0 +1,66 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="7"/>
<General>
<SessionStorage Value="InIDEConfig"/>
<MainUnit Value="0"/>
<TargetFileExt Value=""/>
<Title Value="AggPasInLCLDemo2"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="AggPasLCL"/>
<MinVersion Major="1" Valid="True"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="AggPasInLCLDemo2.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="AggPasInLCLDemo2"/>
</Unit0>
<Unit1>
<Filename Value="unit2.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit2"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)/"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</CONFIG>

View File

@ -0,0 +1,18 @@
program AggPasInLCLDemo1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit2, AggPasLCL
{ you can add units after this };
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@ -0,0 +1,11 @@
object Form1: TForm1
Left = 383
Height = 204
Top = 290
Width = 238
Caption = 'Form1'
OnCreate = FormCreate
OnDestroy = FormDestroy
OnPaint = FormPaint
LCLVersion = '0.9.29'
end

View File

@ -0,0 +1,8 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3#127#1#6'Height'#3#204#0#3'Top'#3'"'#1#5'W'
+'idth'#3#238#0#7'Caption'#6#5'Form1'#8'OnCreate'#7#10'FormCreate'#9'OnDestro'
+'y'#7#11'FormDestroy'#7'OnPaint'#7#9'FormPaint'#10'LCLVersion'#6#6'0.9.29'#0
+#0
]);

View File

@ -0,0 +1,84 @@
unit Unit2;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LCLProc, FileUtil, LResources, Forms, Controls, Graphics,
Dialogs, FPimage, agg_fpimage, Agg_LCL;
type
{ TForm1 }
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
public
AggLCLCanvas: TAggLCLCanvas;
Bitmap1: TBitmap;
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
Bitmap1:=TBitmap.Create;
AggLCLCanvas:=TAggLCLCanvas.Create;
with AggLCLCanvas do begin
Image.PixelFormat:=afpimRGBA32;
Image.SetSize(250,250);
end;
// paint to agg canvas
with AggLCLCanvas do begin
// solid white background
Brush.Color:=clWhite;
FillRect(0,0,Width,Height);
Brush.Color:=clRed;
Pen.Color:=clBlue;
Pen.Width:=1;
Line(10,10,20,10);
Line(10,12,10,22);
end;
// convert to LCL native pixel format
Bitmap1.LoadFromIntfImage(AggLCLCanvas.Image.IntfImg);
// paint with widgetset to bitmap
with Bitmap1.Canvas do begin
Brush.Color:=clBlue;
Pen.Color:=clRed;
Pen.Width:=1;
Line(22,10,32,10);
Line(10,24,10,34);
end;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
AggLCLCanvas.Free;
Bitmap1.Free;
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
Canvas.Draw(0,0,Bitmap1);
end;
initialization
{$I unit2.lrs}
end.