Graphics::TBitmap *bitmap;
   Byte *ptr;
   bitmap->LoadFromFile("c:\\*.bmp");
   bitmap->PixelFormat=pf32bit;   
   for(int y = 0; y < bitmap->Height; y++)
   {
      ptr = static_cast<Byte*>(bitmap->ScanLine[y]);
      for (int x = 0; x < bitmap->Width*4; x++)
      {
         ptr[x] = RGB(255-GetRValue(ptr[x]),255-GetGValue(ptr[x]),255-GetBValue(ptr[x]));
      }
   };   ImageS->Canvas->Draw(0,0,bitmap);
以上是一个图像反百的程序,如果我要用类似的方法调整这幅图像的色阶(类似photoshop中的色彩平衡处理)该怎么去做,请高手赐教。