|
现在透明效果是做出来了啊,但是速度有点慢了,800x480的图片要3秒钟哦,哎,太慢了
我也不知道还能够怎么优化,我把代码贴出来,大家看看能不能帮我优化下,谢谢了
for(int i = 0 ; i < nHeight ; i ++)
{
for(int j = 0 ; j < nWidth ; j++)
{
BYTE btB = pbtPixels[i * nWidth * nPixelSize + j * nPixelSize];
BYTE btG = pbtPixels[i * nWidth * nPixelSize + j * nPixelSize + 1 ];
BYTE btR = pbtPixels[i * nWidth * nPixelSize + j * nPixelSize + 2 ];
BYTE btB1 = pbtPixels1[i * nWidth * nPixelSize + j * nPixelSize];
BYTE btG1 = pbtPixels1[i * nWidth * nPixelSize + j * nPixelSize + 1];
BYTE btR1 = pbtPixels1[i * nWidth * nPixelSize + j * nPixelSize + 2];
btB = btB1 * iTransparency + Transparency0 * btB;
btG = btG1 * iTransparency + Transparency0 * btG;
btR = btR1 * iTransparency + Transparency0 * btR;
pbtPixels[i * nWidth * nPixelSize + j * nPixelSize] = btB ;
pbtPixels[i * nWidth * nPixelSize + j * nPixelSize + 1] = btG;
pbtPixels[i * nWidth * nPixelSize + j * nPixelSize + 2] = btR;
}
} |
|