创建位图上下文时出现此错误:
CGBitmapContextCreate:不支持的参数组合:8 个整数位/组件; 24 位/像素;三分量色彩空间; kCGImageAlphaNone; 7936 字节/行。
这是代码(请注意,上下文基于现有 CGImage 的参数:
context = CGBitmapContextCreate(NULL,
(int)pi.bufferSizeRequired.width,
(int)pi.bufferSizeRequired.height,
CGImageGetBitsPerComponent(imageRef),
0,
CGImageGetColorSpace(imageRef),
CGImageGetBitmapInfo(imageRef));
宽度为 2626,高度为 3981。我将 bytesPerRow 保留为零,以便为我自动计算,并自行选择了 7936。
那么,地球上的不一致在哪里呢?它让我发疯。
最佳答案
由于我不明白的原因,我通过将 BitmapInfo 参数设置为 kCGImageAlphaNoneSkipLast
解决了这个问题。 .
关于macos - CGBitmapContextCreate : unsupported parameter combination,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13527692/