1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
Unit Unit1;
{$mode objfpc}{$H+}
Interface
Uses
Classes, SysUtils, LCLProc, FileUtil, LResources, Forms, Controls, Graphics,
Dialogs, ExtCtrls, FPimage, agg_fpimage, Agg_LCL;
Type
{ TForm1 }
TForm1 = Class(TForm)
Image1: TImage;
Procedure FormCreate(Sender: TObject);
Private
Public
End;
Var
Form1: TForm1;
Implementation
{ TForm1 }
Procedure TForm1.FormCreate(Sender: TObject);
Var
png: tportablenetworkgraphic;
back: TaggFpimage;
Agg: TAggLCLCanvas;
Begin
Form1.Width := 256;
form1.Height := 256;
Try
back := TaggFpImage.Create(256,256);
back.PixelFormat := afpimRGB24;
png := tportablenetworkgraphic.Create;
Agg := TAggLCLCanvas.Create;
With Agg Do
Begin
Image.PixelFormat := afpimRGBA32;
Image.SetSize(256,256);
//Chargement du background depuis png
back.LoadFromFile('back.png');
agg.AggCopyImage(back,0,0);
//elipse bleu interieur rouge alpha
Brush.fpColor := fpcolor($ffff,0,0,$5000);
Pen.fpColor := FPColor(0,0,$ffff,$FFFF);
pen.Width := 3;
aggEllipse(128,128,60,85);
// chargement du canvas dans un png
png.LoadFromIntfImage(Agg.Image.IntfImg);
png.SaveToFile('test.png');
image1.Picture.Assign(png);
End;
Finally
agg.free;
png.Free;
back.Free;
End;
End;
initialization
{$I unit1.lrs}
End. |
Partager