2016-11-22 11 views
2

私のiPhoneアプリでは、私はいつもhorizontally mirrorに次の機能を使用しています。 iOSの10.0.1でiOS 10:CIKernelのROI機能はタイリングを許可していません

-(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; 
} 

ただし、この機能はまだエラーなしで実行されますが、私は、この関数からUIImageを使用しようとすると、次の警告が表示され、画像はそこではないようです。

Failed to render 921600 pixels because a CIKernel's ROI function did not allow tiling. 

私は使用にしようとすると、このエラーは、実際に出力ウィンドウに表示されますUIImage(このコードでは2行目):

UIImage* flippedImage = [self mirrorImage:originalImage];  
UIImageView* photo = [[UIImageView alloc] initWithImage:flippedImage]; 

mirrorImageを呼び出した後、flippedImage変数はありませんには値が含まれていますが、それはnilではありませんが、画像を使用しようとするとそのエラーメッセージが表示されます。

私はした場合mirrorImage関数を呼び出していない場合、コードは正常に動作します:

UIImageView* photo = [[UIImageView alloc] initWithImage:originalImage]; 

が働いてから私のmirrorImage機能を妨げるiOS 10といくつかの新しい癖はありますか?

ちょうど、mirrorImage機能では、変換の前後で画像のサイズをテストしようとしました(エラーは画像にtileという不公平さがあるため)、サイズは同じです。

答えて

1

気にしないでください。

私はiOS 10が壊れているかわからないが、私はこれで私の機能を置き換えることによって、問題を解決するために管理:

-(UIImage*)mirrorImage:(UIImage*)img 
{ 
    UIImage* flippedImage = [UIImage imageWithCGImage:img.CGImage 
               scale:img.scale 
              orientation:UIImageOrientationUpMirrored]; 
    return flippedImage; 
} 
3

私はCIImageを変換して、それを固定 - > CGImage - > UIImage

let ciImage: CIImage = "myCIImageFile" 

let cgImage: CGImage = { 
    let context = CIContext(options: nil) 
    return context.createCGImage(ciImage, from: ciImage.extent)! 
}() 

let uiImage = UIImage(cgImage: cgImage) 
関連する問題