F
FishEatsCats
Unregistered / Unconfirmed
GUEST, unregistred user!
柔化算法,至少在视觉看来是连续的
var red,green,blue,m,n:integer;
begin
for i:=step to x-1-step do begin
for j:=step to y-1-step do begin
red:=srgb[doing,i-step,j-step].r+srgb[doing,i-step,j].r+srgb[doing,i-step,j+step].r+srgb[doing,i,j-step].r+srgb[doing,i,j].r+srgb[doing,i,j+step].r+srgb[doing,i+step,j-step].r+srgb[doing,i+step,j].r+srgb[doing,i+step,j+step].r;
blue:=srgb[doing,i-step,j-step].b+srgb[doing,i-step,j].b+srgb[doing,i-step,j+step].b+srgb[doing,i,j-step].b+srgb[doing,i,j].b+srgb[doing,i,j+step].b+srgb[doing,i+step,j-step].b+srgb[doing,i+step,j].b+srgb[doing,i+step,j+step].b;
green:=srgb[doing,i-step,j-step].g+srgb[doing,i-step,j].g+srgb[doing,i-step,j+step].g+srgb[doing,i,j-step].g+srgb[doing,i,j].g+srgb[doing,i,j+step].g+srgb[doing,i+step,j-step].g+srgb[doing,i+step,j].g+srgb[doing,i+step,j+step].g;
with srgb[1-doing,i,j] do begin
r:=red div 9;
b:=blue div 9;
g:=green div 9;
end;
DXDraw1.Surface.Canvas.Pixels [i,j]:=rgb(red div 9,green div 9,blue div 9);
end;
end;
DXDraw1.Surface.Canvas.Release ;
DXDraw1.Flip ;
inc(step);
Doing:=1-Doing;
这个算法在200*200速度还可以,但是在700*700下就有问题了
本人考虑可以用多线程进行局部柔化不知各位有什么高见
var red,green,blue,m,n:integer;
begin
for i:=step to x-1-step do begin
for j:=step to y-1-step do begin
red:=srgb[doing,i-step,j-step].r+srgb[doing,i-step,j].r+srgb[doing,i-step,j+step].r+srgb[doing,i,j-step].r+srgb[doing,i,j].r+srgb[doing,i,j+step].r+srgb[doing,i+step,j-step].r+srgb[doing,i+step,j].r+srgb[doing,i+step,j+step].r;
blue:=srgb[doing,i-step,j-step].b+srgb[doing,i-step,j].b+srgb[doing,i-step,j+step].b+srgb[doing,i,j-step].b+srgb[doing,i,j].b+srgb[doing,i,j+step].b+srgb[doing,i+step,j-step].b+srgb[doing,i+step,j].b+srgb[doing,i+step,j+step].b;
green:=srgb[doing,i-step,j-step].g+srgb[doing,i-step,j].g+srgb[doing,i-step,j+step].g+srgb[doing,i,j-step].g+srgb[doing,i,j].g+srgb[doing,i,j+step].g+srgb[doing,i+step,j-step].g+srgb[doing,i+step,j].g+srgb[doing,i+step,j+step].g;
with srgb[1-doing,i,j] do begin
r:=red div 9;
b:=blue div 9;
g:=green div 9;
end;
DXDraw1.Surface.Canvas.Pixels [i,j]:=rgb(red div 9,green div 9,blue div 9);
end;
end;
DXDraw1.Surface.Canvas.Release ;
DXDraw1.Flip ;
inc(step);
Doing:=1-Doing;
这个算法在200*200速度还可以,但是在700*700下就有问题了
本人考虑可以用多线程进行局部柔化不知各位有什么高见