24

I found that in IOS UIImage can change to CIImage.and there is a property CIImage in UIImage. and when i use the UIImage,UIImage object is not null but UIImage.ciimage is null ,why?

forgive my stupid question if someone can help me ,thank you very much.


ADD

for example, the code like below return null:

UIImage *image = [UIImage imageNamed:@"test.jpg"];
CIImage *ciImage = image.CIImage

but if in this way CIImage is not null:

UIImage *image = [UIImage imageNamed:@"test.jpg"];
CIImage *myImage = [[CIImage alloc] initWithCGImage:image.CGImage options:nil];
4

1 回答 1

44

这是因为这个 UIImage 实际上不是 CIImage。换句话说,CIImage只有当 UIImage 已经由 CIImage 支持时(例如,因为它是由 生成的imageWithCIImage:),UIImage 才不是 nil。您不能使用它来神奇地将 UIImage 转换为 CIImage,就像您似乎希望做的那样。

文档实际上对此非常清楚。永远值得一读。

于 2013-03-27T03:19:42.360 回答