Reputation: 23883
I got this error message based on code below:
Error message
/Users/MNurdin/Documents/iOS/XXXXX/HAHA.swift:534:38: 'UInt32' is not convertible to 'CGImage'
My code
let context : CGContextRef = CGBitmapContextCreate(nil, CGImageGetWidth(image.CGImage), CGImageGetHeight(image.CGImage),
CGImageGetBitsPerComponent(image.CGImage),
CGImageGetBytesPerRow(image.CGImage),
CGImageGetColorSpace(image.CGImage),
CGImageGetBitmapInfo(UInt32(image.CGImage)).rawValue)!;
CGContextConcatCTM(context, transform);
Upvotes: 0
Views: 585
Reputation: 369
Raw value is returning UInt32 so try:
CGImageGetBitmapInfo(image.CGImage).rawValue
Upvotes: 1
Reputation: 107121
As the error states you are passing a UInt32
to a function which expects a CGImage
.
CGImageGetBitmapInfo expects a CGImage
as it's argument and returns CGBitmapInfo
You are probably looking for:
UInt32(CGImageGetBitmapInfo(image.CGImage).rawValue)
Upvotes: 2
Reputation: 9002
It's exactly as the error states, you can't convert a number to a CGImage
I'm not sure why you're trying to convert a CGImage
into a UInt32
before passing it into CGImageGetBitmapInfo
. Just pass the CGImage
in directly.
CGImageGetBitmapInfo(image.CGImage);
Upvotes: 1