我有这个客观的 C 代码,我正在尝试将色调效果应用于像素级别的图像。当我移动 16 位和 8 位然后相应地屏蔽以获得单独的通道时,我收到了这个错误。有人可以帮我吗?
-(void) Tint :(NSArray *)pixels :(int) intensity
{
intensity+=20;
int RY, BY, RYY, GYY, BYY, R, G, B, Y;
double angle = (3.14 * (double)intensity) / 180;
int index=0;
int S = (int)(256 * sin(angle));
int C = (int)(256 * cos(angle));
int r,g,b;
for (int y = 0; y < [p1 height]; y++)
for (int x = 0; x < [p1 width]; x++)
{
r = ( [pixels objectAtIndex :x] >> 16 ) & 0xff;
g = ( [pixels objectAtIndex :x] >> 8 ) & 0xff;
b = [pixels objectAtIndex :x] & 0xff;
index++;
}
}