21,459
社区成员
发帖
与我相关
我的任务
分享
BYTE * pBits = ...;
RGBQUAD * pSource = (RGBQUAD*) pBits;
float fx=0.5f;
BYTE byNewPixel = 0;
int x1 = m_nWidth/2;
if(x1 < 0) x1 = 0;
for(int x = x1; x < m_nWidth; x++)
{
float x2 = float((float)(x-x1)/600.0);
if(x2 < 0.5)
{
fx = 0.5 * pow((2*x2), 2);
}
else
{
fx = 1 - 0.5 * pow(2 * (1-x2), 2);
}
pSource = (RGBQUAD*)(pBits + (x)*4);
for(int y = 0; y < m_nHeight; y++)
{
pSource->rgbRed = pSource->rgbRed * fx;
pSource->rgbGreen = pSource->rgbGreen * fx;
pSource->rgbBlue = pSource->rgbBlue * fx;
pSource += m_nWidth;
}
}