void
ef_u_clockwiserotation_90(const unsigned char* psrcdata,
const int ntype,
const int width,
const int height,
unsigned char* pdstdata)
{
if (!psrcdata || !pdstdata) {
return;
}
if (ntype == DATA_TYPE_32RGBA) {
int w,h;
for (w = 0; w < width; w++) {
argb *newline = (argb*)(pdstdata + w*height*sizeof(RGBAOGJ));
for (h = 0; h < height; h++) {
argb *oldline = (argb*)(psrcdata + h*width*sizeof(RGBAOGJ));
newline[height-h-1] = oldline[w];
}
}
}
}
2.调整颜色饱和度
把红,绿和蓝三种颜色时进行饱和度运算
// 下面基于NTSC标准来计算。
FLOAT grey = pC->r * 0.2125f + pC->g * 0.7154f + pC->b * 0.0721f;
pOut->r = grey + s * (pC->r - grey);
如果s 大于0并且小于1,饱和度会减少。如果s 大于1,就是增加饱和度。
颜色值如下计算:
r = g = b = 0.2125*r + 0.7154*g + 0.0721*b
3.调整颜色对比度值
说明:
输入的alpha值是完全拷贝,没有任何修改。
这里返回值是跟参数里的pOut 是一样的。通过返回值,可以让这个函数成为别的函数的参数。
这个函数的红,绿,蓝都会用下面的公式计算结果输出:
pOut->r = 0.5f + c * (pC->r - 0.5f);
如果c小于1,就会减小对比度。如果c大于1,就会增加对比度。