mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-25 16:09:17 +02:00
aggpas: started example for pango fonts
git-svn-id: trunk@23066 -
This commit is contained in:
parent
d9ccb124f5
commit
37681395ae
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -87,12 +87,16 @@ 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/PangoFontsDemo1.lpi svneol=native#text/plain
|
||||
components/aggpas/lazarus/example/PangoFontsDemo1.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/lazarus/example/unit3.lfm svneol=native#text/plain
|
||||
components/aggpas/lazarus/example/unit3.lrs svneol=native#text/plain
|
||||
components/aggpas/lazarus/example/unit3.pas svneol=native#text/pascal
|
||||
components/aggpas/line_patterns.dpr svneol=native#text/plain
|
||||
components/aggpas/lion.dpr svneol=native#text/plain
|
||||
|
66
components/aggpas/lazarus/example/PangoFontsDemo1.lpi
Normal file
66
components/aggpas/lazarus/example/PangoFontsDemo1.lpi
Normal 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="PangoFontsDemo1"/>
|
||||
</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="PangoFontsDemo1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="PangoFontsDemo1"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unit3.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit3"/>
|
||||
</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>
|
18
components/aggpas/lazarus/example/PangoFontsDemo1.lpr
Normal file
18
components/aggpas/lazarus/example/PangoFontsDemo1.lpr
Normal file
@ -0,0 +1,18 @@
|
||||
program PangoFontsDemo1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, Unit3, AggPasLCL
|
||||
{ you can add units after this };
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
11
components/aggpas/lazarus/example/unit3.lfm
Normal file
11
components/aggpas/lazarus/example/unit3.lfm
Normal file
@ -0,0 +1,11 @@
|
||||
object Form1: TForm1
|
||||
Left = 387
|
||||
Height = 290
|
||||
Top = 287
|
||||
Width = 415
|
||||
Caption = 'Form1'
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
OnPaint = FormPaint
|
||||
LCLVersion = '0.9.29'
|
||||
end
|
7
components/aggpas/lazarus/example/unit3.lrs
Normal file
7
components/aggpas/lazarus/example/unit3.lrs
Normal file
@ -0,0 +1,7 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TForm1','FORMDATA',[
|
||||
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3#131#1#6'Height'#3'"'#1#3'Top'#3#31#1#5'Wi'
|
||||
+'dth'#3#159#1#7'Caption'#6#5'Form1'#8'OnCreate'#7#10'FormCreate'#9'OnDestroy'
|
||||
+#7#11'FormDestroy'#7'OnPaint'#7#9'FormPaint'#10'LCLVersion'#6#6'0.9.29'#0#0
|
||||
]);
|
@ -6,8 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, FileUtil, LResources, Forms, Controls, Graphics,
|
||||
Dialogs, FPimage, agg_fpimage, Agg_LCL,
|
||||
agg_svg_parser_lcl, agg_svg_path_renderer;
|
||||
Dialogs, FPimage, agg_fpimage, Agg_LCL;
|
||||
|
||||
type
|
||||
|
||||
@ -21,10 +20,6 @@ type
|
||||
public
|
||||
AggLCLCanvas: TAggLCLCanvas;
|
||||
Bitmap1: TBitmap;
|
||||
|
||||
p : parser;
|
||||
m_path : path_renderer;
|
||||
m_min_x, m_min_y, m_max_x, m_max_y: double;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -38,6 +33,11 @@ procedure TForm1.FormCreate(Sender: TObject);
|
||||
var
|
||||
HasFont: Boolean;
|
||||
FontFilename: String;
|
||||
s: String;
|
||||
TxtW: integer;
|
||||
TxtH: integer;
|
||||
TxtX: Integer;
|
||||
TxtY: Integer;
|
||||
begin
|
||||
Bitmap1:=TBitmap.Create;
|
||||
AggLCLCanvas:=TAggLCLCanvas.Create;
|
||||
@ -69,24 +69,13 @@ begin
|
||||
Pen.Color:=clBlue;
|
||||
Pen.Width:=1;
|
||||
|
||||
Line(12,10,22,10);
|
||||
Line(10,12,10,22);
|
||||
Line(12,12,22,22);
|
||||
s:='Font.Size='+IntToStr(Font.Size);
|
||||
GetTextSize(s,TxtW,TxtH);
|
||||
TxtX:=10;
|
||||
TxtY:=40;
|
||||
FillRect(TxtX,TxtY,TxtX+TxtW,TxtY+TxtH);
|
||||
TextOut(TxtX,TxtY,s);
|
||||
|
||||
m_path.Construct;
|
||||
m_min_x:=0.0;
|
||||
m_min_y:=0.0;
|
||||
m_max_x:=0.0;
|
||||
m_max_y:=0.0;
|
||||
|
||||
p.Construct(@m_path);
|
||||
try
|
||||
p.parse(SetDirSeparators('../../svg/tiger.svg'));
|
||||
{m_path.arrange_orientations;
|
||||
m_path.bounding_rect(@m_min_x ,@m_min_y ,@m_max_x ,@m_max_y );}
|
||||
finally
|
||||
p.Destruct;
|
||||
end;
|
||||
end;
|
||||
|
||||
// convert to LCL native pixel format
|
||||
@ -101,10 +90,12 @@ begin
|
||||
Pen.Color:=clBlue;
|
||||
Pen.Width:=1;
|
||||
|
||||
Line(24,10,34,10);
|
||||
Line(10,24,10,34);
|
||||
Line(24,24,34,34);
|
||||
|
||||
s:='Font.Size='+IntToStr(Font.Size);
|
||||
GetTextSize(s,TxtW,TxtH);
|
||||
TxtX:=10;
|
||||
TxtY:=60;
|
||||
FillRect(TxtX,TxtY,TxtX+TxtW,TxtY+TxtH);
|
||||
TextOut(TxtX,TxtY,s);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -112,7 +103,6 @@ procedure TForm1.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
AggLCLCanvas.Free;
|
||||
Bitmap1.Free;
|
||||
m_path.Destruct;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormPaint(Sender: TObject);
|
||||
|
Loading…
Reference in New Issue
Block a user