......
procedure TForm1.Button2Click(sender:Tobject);
var
a,d,c,t,z:byte;
k,i,j:integer;
bmp:Tbitmap;
h:Thue;
m,n,m1,n1:double;
scanline:PRGBline;
r,g,b:byte;
begin
for k:=0 to (imgsize div 3)-1 do
begin
a:=(hsvdata[k]) div 32;
d:=(hsvdata[k] mod 32)div 4;
c:= (hsvdata[k] mod 128) ;
if a=0 then
h:=10
else if a=1 then
h:=30
else if a=2 then
h:=60
else if a=3 then
h:=100
else if a=4 then
h:=180
else if a=5 then
h:=250
else if a=6 then
h:=280
else if a=7 then
h:=310; if d=0 then
m:=0.1
else if d=1 then
m:=0.5
else if d=2 then
m:=0.8
else m:=0; if c=0 then
n:=0.1
else if c=1 then
n:=0.5
else if c=2 then
n:=0.8
else n:=0; bmp:=TBitmap.Create;
bmp.Assign(image1.picture.bitmap);
for i:=0 to image1.Height-1 do
begin
scanline:=Bmp.Scanline[i];
for j:=0 to bmp.Width-1 do
begin
m1:=m*255;
n1:=n*255;
t:=trunc(m1);
z:=trunc(n1);
hsvtorgb(h,t,z,r,g,b);
scanline[j].R:=r;
scanline[j].G:=g;
scanline[j].B:=b;
end;
end;
Image2.Picture.Bitmap.Assign(bmp);
Image2.Refresh;
bmp.free;
end;
end;
......
procedure TForm1.Button2Click(sender:Tobject);
var
a,d,c,t,z:byte;
k,i,j:integer;
bmp:Tbitmap;
h:Thue;
m,n,m1,n1:double;
scanline:PRGBline;
r,g,b:byte;
begin
for k:=0 to (imgsize div 3)-1 do
begin
a:=(hsvdata[k]) div 32;
d:=(hsvdata[k] mod 32)div 4;
c:= (hsvdata[k] mod 128) ;
if a=0 then
h:=10
else if a=1 then
h:=30
else if a=2 then
h:=60
else if a=3 then
h:=100
else if a=4 then
h:=180
else if a=5 then
h:=250
else if a=6 then
h:=280
else if a=7 then
h:=310; if d=0 then
m:=0.1
else if d=1 then
m:=0.5
else if d=2 then
m:=0.8
else m:=0; if c=0 then
n:=0.1
else if c=1 then
n:=0.5
else if c=2 then
n:=0.8
else n:=0; bmp:=TBitmap.Create;
bmp.Assign(image1.picture.bitmap);
for i:=0 to image1.Height-1 do
begin
scanline:=Bmp.Scanline[i];
for j:=0 to bmp.Width-1 do
begin
m1:=m*255;
n1:=n*255;
t:=trunc(m1);
z:=trunc(n1);
hsvtorgb(h,t,z,r,g,b);
scanline[j].R:=r;
scanline[j].G:=g;
scanline[j].B:=b;
end;
end;
Image2.Picture.Bitmap.Assign(bmp);
Image2.Refresh;
bmp.free;
end;
end;
......
Image2.Picture.Bitmap.Assign(bmp);
是将bmp的位图赋值给 Image2.Picture.Bitmap
但是此时bmp中并没有位图,那些东西是你自己画上去的!
我的目的是对image1里的象素进行处理,然后在image2里显示出来!