diff --git a/.gitattributes b/.gitattributes index 6909dba3cd..8193545755 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/components/aggpas/lazarus/aggpaslcl.lpk b/components/aggpas/lazarus/aggpaslcl.lpk index d19a1db3e0..b59553841a 100644 --- a/components/aggpas/lazarus/aggpaslcl.lpk +++ b/components/aggpas/lazarus/aggpaslcl.lpk @@ -223,7 +223,6 @@ This software is provided "as is" without express or implied warranty, - @@ -895,11 +894,14 @@ This software is provided "as is" without express or implied warranty, - + + + + - + diff --git a/components/aggpas/lazarus/example/AggPasInLCLDemo1.lpi b/components/aggpas/lazarus/example/AggPasInLCLDemo1.lpi new file mode 100644 index 0000000000..83554bc460 --- /dev/null +++ b/components/aggpas/lazarus/example/AggPasInLCLDemo1.lpi @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/aggpas/lazarus/example/AggPasInLCLDemo1.lpr b/components/aggpas/lazarus/example/AggPasInLCLDemo1.lpr new file mode 100644 index 0000000000..946fd866d0 --- /dev/null +++ b/components/aggpas/lazarus/example/AggPasInLCLDemo1.lpr @@ -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. + diff --git a/components/aggpas/lazarus/example/unit1.lfm b/components/aggpas/lazarus/example/unit1.lfm new file mode 100644 index 0000000000..be01d3354d --- /dev/null +++ b/components/aggpas/lazarus/example/unit1.lfm @@ -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 diff --git a/components/aggpas/lazarus/example/unit1.lrs b/components/aggpas/lazarus/example/unit1.lrs new file mode 100644 index 0000000000..c807cb7408 --- /dev/null +++ b/components/aggpas/lazarus/example/unit1.lrs @@ -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 +]); diff --git a/components/aggpas/lazarus/example/unit1.pas b/components/aggpas/lazarus/example/unit1.pas new file mode 100644 index 0000000000..c767bde8a0 --- /dev/null +++ b/components/aggpas/lazarus/example/unit1.pas @@ -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. + diff --git a/components/aggpas/src/agg_lcl.pas b/components/aggpas/src/agg_lcl.pas index 84a8e673f4..ccf2a1e2ce 100755 --- a/components/aggpas/src/agg_lcl.pas +++ b/components/aggpas/src/agg_lcl.pas @@ -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