【发布时间】:2010-03-25 03:33:45
【问题描述】:
我已经尝试混合两个 UIImage 大约 2 天了,但我遇到了一些 BAD_ACCESS 错误。首先,我有两个方向相同的图像,基本上我使用 CoreGraphics 来进行混合。
有一个奇怪的细节,每次我修改代码,第一次在设备上编译和运行它时,我都可以毫无困难地做任何我想做的事情。重新启动应用程序后,出现错误并关闭程序。
谁能给我一盏灯?我尝试动态访问 baseImage 大小,但它也给了我不好的访问权限。
这里是我如何进行混合的 sn-p。
UIGraphicsBeginImageContext(CGSizeMake(320, 480));
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(context, 0, 480);
CGContextScaleCTM(context, 1.0, -1.0);
CGContextDrawImage(context, rect, [baseImage CGImage]);
CGContextSetBlendMode(context, kCGBlendModeOverlay);
CGContextDrawImage(context, rect, [tmpImage CGImage]);
[transformationView setImage:UIGraphicsGetImageFromCurrentImageContext()];
UIGraphicsEndImageContext();
补充:有时它可以完美地工作,没问题。有时它只是覆盖而不混合。其他的它会使 iphone 崩溃。
【问题讨论】:
标签: iphone exc-bad-access cgcontext blending