GPUImage2 PictureOutput.swift 类中CGImage转UIImage时,bitmapInfo参数传入了默认的CGBitmapInfo(),没有透明通道
return CGImage(width:Int(framebuffer.size.width), height:Int(framebuffer.size.height), bitsPerComponent:8, bitsPerPixel:32, bytesPerRow:4 * Int(framebuffer.size.width), space:defaultRGBColorSpace, bitmapInfo:CGBitmapInfo() /*| CGImageAlphaInfo.Last*/, provider:dataProvider, decode:nil, shouldInterpolate:false, intent:.defaultIntent)!
将其注释中的bitmapInfo取代默认的CGBitmapInfo()即可输出透明度图片
return CGImage(width:Int(framebuffer.size.width), height:Int(framebuffer.size.height), bitsPerComponent:8, bitsPerPixel:32, bytesPerRow:4 * Int(framebuffer.size.width), space:defaultRGBColorSpace, bitmapInfo:CGBitmapInfo(rawValue: CGImageAlphaInfo.last.rawValue) /*| CGImageAlphaInfo.Last*/, provider:dataProvider, decode:nil, shouldInterpolate:false, intent:.defaultIntent)!
相关提交:
https://github.com/liuqiaohong0515/GPUImage2/commit/9790b6aa760f85ed40aed670c72b5c7702322355
相关代码上传到了GPUImage2的一个fork上,可以直接下载使用:
https://github.com/liuqiaohong0515/GPUImage2
© 版权声明
文章版权归作者所有,未经允许请勿转载。如内容涉嫌侵权,请在本页底部进入<联系我们>进行举报投诉!
THE END


















- 最新
- 最热
只看作者