8
Classes, SysUtils, LCLProc, FileUtil, LResources, Forms, Controls, Graphics,
9
Dialogs, FPimage, agg_fpimage, Agg_LCL;
16
procedure FormCreate(Sender: TObject);
17
procedure FormDestroy(Sender: TObject);
18
procedure FormPaint(Sender: TObject);
21
AggLCLCanvas: TAggLCLCanvas;
32
procedure TForm1.FormCreate(Sender: TObject);
42
Bitmap1:=TBitmap.Create;
43
AggLCLCanvas:=TAggLCLCanvas.Create;
44
with AggLCLCanvas do begin
45
Image.PixelFormat:=afpimRGBA32;
46
Image.SetSize(500,500);
54
// paint to agg canvas
55
with AggLCLCanvas do begin
57
FontFilename:=SetDirSeparators('../../verdana.ttf');
58
if not FileExistsUTF8(FontFilename) then raise Exception.Create('file not found: '+FontFilename+' CurDir='+GetCurrentDirUTF8);
59
Font.LoadFromFile(FontFilename);
64
// solid white background
66
FillRect(0,0,Width,Height);
76
FillRect(40,10,50,20);
78
GradientFill(Rect(70,10,80,20),clRed,clBlue,gdVertical);
80
Arc(100,10,110,20, 0,2700);
81
Arc(115,10,125,20, 1000,2700);
82
Arc(130,10,140,20, 135,5, 130,20);
83
Chord(145,10,165,30, 0,2000);
84
Chord(170,10,190,30, 1000,2000);
85
Chord(195,10,215,30, 205,5, 195,30);
86
Pie(220,10,240,30, 230,5, 220,30);
87
RadialPie(245,10,265,30, 1000,2000);
89
s:='Font.Size='+IntToStr(Font.Size);
90
GetTextSize(s,TxtW,TxtH);
93
FillRect(TxtX,TxtY,TxtX+TxtW,TxtY+TxtH);
96
RoundRect(10,80,30,100,15,15);
97
Polyline([Point(35,80),Point(45,80),Point(55,80),Point(55,90),
98
Point(55,90),Point(55,100),Point(35,90),Point(35,100)]);
99
PolyBezier([Point(35,80),Point(45,80),Point(55,80),Point(55,90),
100
Point(55,90),Point(55,100),Point(35,90),Point(35,100)],
104
// convert to LCL native pixel format
105
Bitmap1.LoadFromIntfImage(AggLCLCanvas.Image.IntfImg);
107
// paint with widgetset to bitmap
108
with Bitmap1.Canvas do begin
120
FillRect(40,22,50,32);
121
Ellipse(55,22,65,32);
122
GradientFill(Rect(70,22,80,32),clRed,clBlue,gdVertical);
124
Arc(100,22,110,32, 0,2700);
125
Arc(115,22,125,32, 1000,2700);
126
Arc(130,22,140,32, 135,15, 130,32);
127
Chord(145,32,165,52, 0,2000);
128
Chord(170,32,190,52, 1000,2000);
129
Chord(195,32,215,52, 205,27, 195,52);
130
Pie(220,32,240,52, 230,27, 220,52);
131
RadialPie(245,32,265,52, 1000,2000);
133
s:='Font.Size='+IntToStr(Font.Size);
134
GetTextSize(s,TxtW,TxtH);
137
FillRect(TxtX,TxtY,TxtX+TxtW,TxtY+TxtH);
138
TextOut(TxtX,TxtY,s);
140
RoundRect(10,105,30,125,15,15);
141
Polyline([Point(35,105),Point(45,105),Point(55,105),Point(55,115),
142
Point(55,115),Point(55,125),Point(35,115),Point(35,125)]);
143
PolyBezier([Point(35,105),Point(45,105),Point(55,105),Point(55,115),
144
Point(55,115),Point(55,125),Point(35,115),Point(35,125)],
149
procedure TForm1.FormDestroy(Sender: TObject);
155
procedure TForm1.FormPaint(Sender: TObject);
157
Canvas.Draw(0,0,Bitmap1);