aggpas: example

git-svn-id: trunk@21949 -
This commit is contained in:
mattias 2009-10-01 14:46:58 +00:00
parent 22e77f546c
commit 86798d3d1d
8 changed files with 203 additions and 3 deletions

5
.gitattributes vendored
View File

@ -82,6 +82,11 @@ components/aggpas/image_transforms.dpr svneol=native#text/plain
components/aggpas/image_transforms.txt svneol=native#text/plain
components/aggpas/interactive_polygon_.pas svneol=native#text/plain
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/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/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

@ -223,7 +223,6 @@ This software is provided "as is" without express or implied warranty,
</Item48>
<Item49>
<Filename Value="../src/agg_lcl.pas"/>
<AddToUsesPkgSection Value="False"/>
<UnitName Value="Agg_LCL"/>
</Item49>
<Item50>
@ -895,11 +894,14 @@ This software is provided &quot;as is&quot; without express or implied warranty,
</Item211>
</Files>
<Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="1">
<RequiredPkgs Count="2">
<Item1>
<PackageName Value="LCL"/>
</Item1>
<Item2>
<PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/>
</Item1>
</Item2>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)/"/>

View File

@ -0,0 +1,67 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="7"/>
<General>
<SessionStorage Value="InIDEConfig"/>
<MainUnit Value="0"/>
<TargetFileExt Value=""/>
<Icon Value="0"/>
<UseXPManifest Value="True"/>
</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="AggPasInLCLDemo1.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="AggPasInLCLDemo1"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
</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,21 @@
program AggPasInLCLDemo1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1, LResources, AggPasLCL
{ you can add units after this };
{$IFDEF WINDOWS}{$R AggPasInLCLDemo1.rc}{$ENDIF}
begin
{$I AggPasInLCLDemo1.lrs}
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 Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, 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);
// a star with 5 corners, solid blue outline, filled solid yellow
Brush.Color:=clYellow;
Pen.Color:=clBlue;
Pen.Width:=8;
Ellipse(20,50,100,100);
// a star with 5 corners, transparent blue outline, filled transparent yellow
Brush.FPColor:=FPColor($ffff,$ffff,0,$5000);
Pen.FPColor:=FPColor(0,0,$ffff,$5000);
Ellipse(40,65,120,130);
// solid blue text
Font.LoadFromFile('../../verdana.ttf');
Font.Size:=18;
Font.Color:=clRed;
TextOut(10,30,'LCL and AggPas');
end;
// convert to LCL native pixel format
Bitmap1.LoadFromIntfImage(AggLCLCanvas.Image.IntfImg);
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 unit1.lrs}
end.

View File

@ -2,6 +2,8 @@
unit
Agg_LCL;
{$mode objfpc}{$H+}
interface
// With this define you can switch use of FreeType or Win32 TrueType font engine