哪位大牛知道photoshop羽化算法的原理?非常想了解一下
柔化效果
void __fastcall TForm1::btnSmoothClick
(TObject *Sender)
{
int red,green,blue;
for(i=1;i< width-2;i++)
for(j=1;j< height-2;j++){
red=rgb[i-1][j-1].r_color+rgb[i][j-1].r
_color+rgb[i+1][j-1].r_color+
rgb[i-1][j].r_color+rgb[i][j].r
_color+rgb[i+1][j].r_color+
rgb[i-1][j+1].r_color+rgb[i][j+1].r
_color+rgb[i+1][j+1].r_color;
green=rgb[i-1][j-1].g_color+rgb[i][j-1].g
_color+rgb[i+1][j-1].g_color+
rgb[i-1][j].g_color+rgb[i][j].g
_color+rgb[i+1][j].g_color+
rgb[i-1][j+1].g_color+rgb[i][j+1].g
_color+rgb[i+1][j+1].g_color;
blue=rgb[i-1][j-1].b_color+rgb[i][j-1].b
_color+rgb[i+1][j-1].b_color+
rgb[i-1][j].b_color+rgb[i][j].b
_color+rgb[i+1][j].b_color+
rgb[i-1][j+1].b_color+rgb[i][j+1].b
_color+rgb[i+1][j+1].b_color;
bitmap- >Canvas- >Pixels[i][j]
=RGB(red/9,green/9,blue/9);
}
Image1- >Picture- >Bitmap- >Assign(bitmap);
}