Iphone CISourceOverCompositing在设备和模拟器上产生不同的结果

Iphone CISourceOverCompositing在设备和模拟器上产生不同的结果,iphone,ios,ios5,core-image,Iphone,Ios,Ios5,Core Image,我试图使用cisourceovercomposition过滤器,但遇到了一些问题 这是相关代码。掩码是一个UIImage,图像是一个UIImage ci_mask = [[CIImage alloc] initWithCGImage: mask.CGImage]; ctx = [CIContext contextWithOptions: nil]; compo = [CIFilter filterWithName: @"CISourceOverCompositing"]; for(int i =

我试图使用
cisourceovercomposition
过滤器,但遇到了一些问题

这是相关代码。掩码是一个
UIImage
,图像是一个
UIImage

ci_mask = [[CIImage alloc] initWithCGImage: mask.CGImage];
ctx = [CIContext contextWithOptions: nil];
compo = [CIFilter filterWithName: @"CISourceOverCompositing"];
for(int i = 0; i < images.count; i++) {
  UIImage *image = [images objectAtIndex: i];
  ci_base = [[CIImage alloc] initWithCGImage: image.CGImage];
  [compo setDefaults];
  [compo setValue: ci_mask forKey: @"inputImage"];
  [compo setValue: ci_base forKey: @"inputBackgroundImage"];
  result = compo.outputImage;

  CGImageDestinationAddImage(
    dst_ref,
    [ctx createCGImage: result fromRect:result.extent],
    frame_props
  );
}
ci_mask=[[CIImage alloc]initWithCGImage:mask.CGImage];
ctx=[CIContext contextWithOptions:nil];
compo=[CIFilter filter,其名称:@“CISourceOverCompositing”];
对于(int i=0;i
mask
包含一个alpha通道,该通道在模拟器中正确应用,但在设备上未正确应用。输出仅显示表面上看不到的遮罩,而不使用alpha通道混合图像

使用CoreGraphics API的几乎相同的代码运行良好(但是我不能应用其他CIFILTER)


我可能会尝试使用
CIBlendWithMask
,但是我必须提取掩码并增加复杂性…

在文件名和指定的文件中查找不同的大小写。在模拟器中工作时,它们不必是相同的大小写,但在设备上它们是区分大小写的。这已经让我厌烦了很多次,如果你不去寻找,很难找到它。

好的,我发现了这个问题,它有点棘手。首先,为了回答Jeshua的问题,掩码和基都是生成的,因此路径在这里并不相关(但我会记住这一点,确切地说,很高兴知道这一点)

现在是“解决方案”。生成掩码时,我在后台上下文中使用了CG*调用的组合(
CGImageCreateWithMask
,…)。现在,这些调用的结果似乎给了我一个似乎没有alpha通道的
CGImage
CGImageGetAlphaInfo
返回0),但是。。。设备上和模拟器中的CoreGraphics API以及CoreImage API(但仅在模拟器中)都应用了仍然存在的alpha通道

使用
KCGimageAlphaPremultipledLast
创建CGContext,并使用
kCGBlendModeSourceOut
创建CGContext(或任何需要“挖空”图像的内容),保持alpha通道完好无损,这在模拟器和设备上都有效

我将提交一份雷达文件,因为模拟器或设备是错误的