我只想:
1)复制像素数据。
2)迭代和修改每个像素(只是告诉我如何将 ARGB 值 NSLog 为 255)
3)从新的像素数据创建一个 UIImage
如果有人能告诉我如何将像素的 RGBA 值 NSLog 为 255,我可以弄清楚血淋淋的细节。如何修改以下代码来做到这一点?请具体!
-(UIImage*)modifyPixels:(UIImage*)originalImage
{
NSData* pixelData = (NSData*)CGDataProviderCopyData(CGImageGetDataProvider(originalImage.CGImage));
uint myLength = [pixelData length];
for(int i = 0; i < myLength; i += 4) {
//CHANGE PIXELS HERE
/*
Sidenote: Just show me how to NSLog them
*/
//Example:
//NSLog(@"Alpha 255-Value is: %u", data[i]);
//NSLog(@"Red 255-Value is: %u", data[i+1]);
//NSLog(@"Green 255-Value is: %u", data[i+2]);
//NSLog(@"Blue 255-Value is: %u", data[i+3]);
}
//CREATE NEW UIIMAGE (newImage) HERE
return newImage;
}