TAlpha类的灰色浮雕处理函数GrayEmboss_1000

//灰色浮雕[maxwidth:1000]
void TAlpha::GrayEmboss_1000(byte &r, byte &g, byte &b, byte &a, int x, int y, int width, int height, void *Para)
{
 const int maxsize = 1000;
 static byte rgb[maxsize];

 if (y == 0)
  {
   if (x < maxsize)
    {
     rgb[x] = GrayScale(r, g, b);
     r = g = b = 128;
    }
  }
 else
  {
   static int v;

   if (x == 0)
    {
     v = rgb[x];
     rgb[x] = GrayScale(r, g, b);
     r = g = b = 128;
    }
   else if (x < maxsize)
    {
     byte n;

     if ((v = (n = GrayScale(r, g, b)) - v + 128) <= 0)
      r = g = b = 0;
     else if (v >= 255)
      r = g = b = 255;
     else
      r = g = b = (byte)v;

     v = rgb[x];
     rgb[x] = n;
    }
  }
}

    通过 void Process_Plus(HDC hdc, int X, int Y, int Width, int Height, typeprocess_plus_op_fun_ptr op_fun_ptr, void *funPara) 函数来调用。 

你可能感兴趣的:(TAlpha类的灰色浮雕处理函数GrayEmboss_1000)