【发布时间】:2016-03-08 17:05:20
【问题描述】:
要在 Objective-C 中创建 CVPixelBuffer 属性,我会这样做:
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], kCVPixelBufferCGImageCompatibilityKey,
[NSNumber numberWithBool:YES], kCVPixelBufferCGBitmapContextCompatibilityKey,
nil];
然后在CVPixelBufferCreate 肉类中,我将(__bridge CFDictionaryRef) attributes 作为参数传递。
在 Swift 中,我正在尝试像这样创建我的字典:
let attributes:[CFString : NSNumber] = [
kCVPixelBufferCGImageCompatibilityKey : NSNumber(bool: true),
kCVPixelBufferCGBitmapContextCompatibilityKey : NSNumber(bool: true)
]
但我发现 CFString 不是可散列的,而且我一直无法让它工作。
谁能提供一个例子来说明这在 Swift 中是如何工作的?
【问题讨论】:
标签: swift cvpixelbuffer cfdictionary