void CsuofangView::Onrou()//柔化
{
// TODO: 在此添加命令处理程序代码
Graphics graphics(m_hWnd);
/*Bitmap bmp(L"mei.jpg");
graphics.DrawImage(&bmp,0,0,400,400);
graphics.DrawImage(&bmp,400,400,200,200);*/
Status status=GenericError;
status=graphics.GetLastStatus();
if(status!=Ok)
return;
Bitmap bmp(L"mei.jpg");
status=bmp.GetLastStatus();
if(status!=Ok)
return;
int width=bmp.GetWidth();
int height=bmp.GetHeight();
Bitmap newbmp(width,height);
Bitmap new2bmp(width,height);
Color pixel1,pixel2,pixel;
graphics.DrawImage(&bmp,10,0,width,height);
int Laplacian[]={-1,-1,-1,-1,9,-1,-1,-1,-1};
int smoothGauss[]={1,2,1,2,4,2,1,2,1};
for(int i=1;i<width-1;i++)
{
for(int j=1;j<height-1;j++)
{
int r=0,g=0,b=0,rr=0,gg=0,bb=0;
int index=0;
for(int x=-1;x<=1;x++)
{
for(int y=-1;y<=1;y++)
{
bmp.GetPixel(i+x,j+y,&pixel);
//bmp.GetPixel(i+x,j+y,&pixel2);
r+=pixel.GetRed()*smoothGauss[index];
g+=pixel.GetGreen()*smoothGauss[index];
b+=pixel.GetBlue()*smoothGauss[index];
//rr+=pixel2.GetRed()*smoothGauss[index];
//gg+=pixe12.GetGreen()*smoothGauss[index];
//bb+=pixe12.GetBlue()*smoothGauss[index];
index++;