G
ghostxp007
Unregistered / Unconfirmed
GUEST, unregistred user!
程序代码如下,希望能得到模糊的效果,望各位帮帮忙看看,为什么会恢复成原来的样子?
谢谢了先!
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtDlgs, ExtCtrls, StdCtrls,jpeg,math;
type
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
Button2: TButton;
OpenPictureDialog1: TOpenPictureDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
openpicturedialog1.Execute;
image1.Picture.LoadFromFile(openpicturedialog1.FileName);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
x,y:integer;
pbytearray;
bmp:tbitmap;
begin
bmp:=tbitmap.Create;
bmp.Assign(image1.Picture.Graphic);
for y:=0 to bmp.Height-1 do
begin
p:=bmp.ScanLine[y];
for x:=0 to bmp.Width -1 do
begin
canvas.Pixels[x,y]:=canvas.Pixels[x+random(10),y+random(10)];
end;
end;
image1.Picture.Bitmap.Assign(bmp);
end;
end.
谢谢了先!
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtDlgs, ExtCtrls, StdCtrls,jpeg,math;
type
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
Button2: TButton;
OpenPictureDialog1: TOpenPictureDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
openpicturedialog1.Execute;
image1.Picture.LoadFromFile(openpicturedialog1.FileName);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
x,y:integer;
pbytearray;
bmp:tbitmap;
begin
bmp:=tbitmap.Create;
bmp.Assign(image1.Picture.Graphic);
for y:=0 to bmp.Height-1 do
begin
p:=bmp.ScanLine[y];
for x:=0 to bmp.Width -1 do
begin
canvas.Pixels[x,y]:=canvas.Pixels[x+random(10),y+random(10)];
end;
end;
image1.Picture.Bitmap.Assign(bmp);
end;
end.