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
| procedure TForm1.FormPaint(Sender: TObject);
var x,y,Res: integer;
i,j:Byte;
p: PBGRAPixel;
image: TBGRABitmap;
begin
i:=Random(3);
j:=Random(3);
image := TBGRABitmap.Create(ClientWidth,ClientHeight);
for y := 0 to image.Height-2 do
begin
p := image.Scanline[y];
for x := 0 to image.Width-2 do
begin
Case j of
0: Res:=(x*y);
1: Res:=Sqr(x*y);
2: Res:=Trunc(Sqrt(x*y));
end;
Case i of
0:begin p^.red:=Res; p^.blue:= 20*x DIV image.Height; p^.green:= 50*y DIV image.Width end;
1:begin p^.blue:=Res; p^.green:= 20*x DIV image.Height; p^.red:= 50*y DIV image.Width end;
2:begin p^.green:=Res; p^.red:= 20*x DIV image.Height; p^.blue:= 50*y DIV image.Width end;
end;
p^.alpha :=255;
inc(p);
end;
end;
image.InvalidateBitmap;
image.Draw(Canvas,0,0,True);
image.free;
end; |
Partager