Swift
1 let baseAddress: UnsafeMutablePointer<Void> = CVPixelBufferGetBaseAddressOfPlane(imageBuffer,0) 2 3 let bytesPerRow: Int = CVPixelBufferGetBytesPerRow(imageBuffer) 4 let width: Int = CVPixelBufferGetWidth(imageBuffer) 5 let height: Int = CVPixelBufferGetHeight(imageBuffer) 6 7 // RGB色空間を作成 8 let colorSpace: CGColorSpaceRef = CGColorSpaceCreateDeviceRGB()! 9 10 // Bitmap graphic contextを作成 11 let bitsPerCompornent: Int = 8 12 let bitmapInfo = CGBitmapInfo(rawValue: (CGBitmapInfo.ByteOrder32Little.rawValue | CGImageAlphaInfo.PremultipliedFirst.rawValue) as UInt32) 13 let newContext: CGContextRef = CGBitmapContextCreate(baseAddress, width, height, bitsPerCompornent, bytesPerRow, colorSpace, bitmapInfo) as CGContextRef
のように書いたのですが
Swift
1let newContext: CGContextRef = CGBitmapContextCreate(baseAddress, width, height, bitsPerCompornent, bytesPerRow, colorSpace, bitmapInfo) as CGContextRef
の引数bitmapInfoで
Cannot convert value of type 'CGBitmapInfo' to expected argument of type UInt32
というエラーが出ます
どうしたらエラーがなくなるでしょうか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/05/17 06:26