BYTE bySaturationMap[256*256]; //滚动条0-255 //...... CreateSaturationMap(m_saturationctl.GetPos()); //...... void CreateSaturationMap(BYTE value) { int nTmp; for (int g=0; g<256; ++g) { for (int i=0; i<256; ++i) { nTmp = g+ value*(i-g)/128; nTmp = min(255, max(0, nTmp)); bySaturationMap[g*256+i] = nTmp; } } } void Img_ISP(BYTE* pData, int wid, int hei) { int g, r, b; BYTE *pNode = NULL; pNode = pData; for (int j=0; j<hei; j++) { for (int i=0; i<wid; i++) { r = *pNode; g = *(pNode+1); b = *(pNode+2); *pNode = bySaturationMap[g*256+r]; *(pNode+2) = bySaturationMap[g*256+b]; pNode = pNode+3; } } }
原文地址:http://www.cnblogs.com/youfal/p/3833483.html