图像反色问题
下面是代码,有时候在反色处理的时候,图像右边有一部分图像不变化,特别是在灰度图像的时候,
而且在处理完浮雕以后都有一部分图像不变化,请帮忙解决一下。
Graphics::TBitmap *pBitmap = new Graphics::TBitmap();
BYTE *ptr;
pBitmap->Assign(CurrentForm->Image1->Picture->Graphic);
pBitmap->Width=CurrentForm->Image1->Width ;
pBitmap->Height=CurrentForm->Image1->Height ;
for (int y = 0; y <pBitmap->Height; y++)
{
ptr =(BYTE *)pBitmap-> ScanLine[y];
for (int x = 0; x < pBitmap->Width*3; x+=3)
{
ptr[x]=BYTE(255-ptr[x]);
ptr[x+1]=BYTE(255-ptr[x+1]);
ptr[x+2]=BYTE(255-ptr[x+2]);
}
}
CurrentForm->Image1->Picture->Graphic=pBitmap;
delete pBitmap;