procedure
TForm1.Button1Click(Sender: TObject);
var
png: tpngobject;
bmp: tbitmap;
canvas: tcanvas;
i: integer;
begin
png := tpngobject.createblank(COLOR_PALETTE, 4, 150, 150);
png.Canvas.Brush.Color := clBlack;
png.Canvas.FillRect(Rect(0,0,png.width,png.height));
png.canvas.pen.color := clRed;
png.canvas.pen.width := 10;
png.canvas.brush.Style := bsClear;
png.canvas.Ellipse(20,20,png.width-20,png.width - 20);
for i := 1 to 30 do
begin
case round(Random*5) of
0: png.canvas.pen.color := clRed;
1: png.canvas.pen.color := clBlue;
2: png.canvas.pen.color := clWhite;
3: png.canvas.pen.color := clGreen;
4: png.canvas.pen.color := clYellow;
end;
png.canvas.Pen.Width := round(random*10);
png.canvas.MoveTo(round(random*png.width),round(random*png.height));
png.Canvas.LineTo(round(random*png.width),round(random*png.height));
end;
png.TransparentColor := clBlack;
png.InterlaceMethod := imAdam7;
png.MaxIdatSize := 100;
png.AddztXt('Made using', 'PNG Delphi 1.56');
png.AddztXt('Website', 'http://pngdelphi.sourceforge.net');
with tchunktime(png.Chunks.Add(tchunktime)) do
begin
Year := 2006;
Month := 5;
Day := 5;
Hour := 21;
Minute := 24;
Second := 21;
end;
png.savetofile('C:\new.png');
png.free;
end;