在首次推出应用程序时,我想展示UIImage。 2秒后,我必须将其写入文件。每次下次启动应用程序时,我都必须阅读文件并在屏幕上绘制然后每1秒钟,我必须在其上绘制5个随机点的UIBezierPath。当应用程序关闭时,必须将包含所有UIBezierPaths渲染的UIImage的最新版本写入文件。
我想使用这样的代码:
UIImage *imageSrc = [UIImage imageWithContentsOfFile];
UIGraphicsGetImageFromCurrentImageContext();
[imageSrc drawInRect:];
[UIBezierPath fill]; // bezier path with 5 points
UIImage *imageNew = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData *dataNew = UIImagePNGRepresentation(imageNew);
[dataNew writeToFile: atomically:YES];
我的问题:UIImagePNGRepresentation是无损的吗?经过500次重复后我能否观察到质量损失?也许更好的是使用CGBitmapContext?