在我的 iPhone 应用程序中,我总是使用以下函数来horizontally mirror
一个图像。
-(UIImage*)mirrorImage:(UIImage*)img
{
CIImage *coreImage = [CIImage imageWithCGImage:img.CGImage];
coreImage = [coreImage imageByApplyingTransform:CGAffineTransformMakeScale(-1, 1)];
img = [UIImage imageWithCIImage:coreImage scale:img.scale orientation:UIImageOrientationUp];
return img;
}
不过,在 iOS 10.0.1 中,这个函数仍然运行没有错误,但是当我尝试使用UIImage
从这个函数中,出现以下警告,并且图像似乎不存在。
Failed to render 921600 pixels because a CIKernel's ROI function did not allow tiling.
当我尝试执行此操作时,此错误实际上出现在“输出”窗口中use the UIImage
(在此代码的第二行中):
UIImage* flippedImage = [self mirrorImage:originalImage];
UIImageView* photo = [[UIImageView alloc] initWithImage:flippedImage];
打电话后mirrorImage
, the flippedImage
多变的does包含一个值,它不是nil
,但是当我尝试使用该图像时,我收到该错误消息。
如果我要not call the mirrorImage
函数,那么代码就可以正常工作:
UIImageView* photo = [[UIImageView alloc] initWithImage:originalImage];
有什么新的怪癖吗iOS 10
这会阻止我mirrorImage
工作功能?
只是补充一下,在mirrorImage
函数,我尝试测试转换前后图像的大小(因为错误抱怨必须tile
图像),并且大小相同。