1,420
社区成员
发帖
与我相关
我的任务
分享
let colorSpace: CGColorSpaceRef = CGColorSpaceCreateDeviceRGB()!
let imgWidth = 600
let imgHeight = 600
let bitsPerPixel = 32
let bytesPerRow = 4 * imgWidth
let bitsPerComponent = 8
let renderingIntent:CGColorRenderingIntent = CGColorRenderingIntent.RenderingIntentAbsoluteColorimetric
let bitmapInfo: CGBitmapInfo = CGBitmapInfo.ByteOrder32Big
let provider: CGDataProviderRef = CGDataProviderCreateWithData(nil, pixels, imgWidth * imgHeight * 4, nil)!
let imgref = CGImageCreate(imgWidth, imgHeight, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpace, bitmapInfo, provider, nil, false, renderingIntent)!
self.realImage = UIImage.init(CGImage: imgref)