任何人都可以向我展示如何使用的清晰示例
CGImageRef CGImageCreate ( size_t width, size_t height, size_t bitsPerComponent, size_t bitsPerPixel, size_t bytesPerRow, CGColorSpaceRef colorspace, CGBitmapInfo bitmapInfo, CGDataProviderRef provider, const CGFloat decode[], bool shouldInterpolate, CGColorRenderingIntent intent );我有一个CGFloat dataBuffer [width * height * 3];
它包含图像的所有RGB数据。 本质上,它从像素R(0,0),G(0,0),B(0,0),R(0,1)...到R(宽度,高度),G(宽度,高度) ,B(宽度,高度)
我知道图像的大小,宽度x高度。 我如何使用我拥有并创建的信息和CGImage?
请帮忙,谢谢
我发布了另一个包含上述问题的问题。 它被nschmidt正确回答,这里是链接
在Objective-C ++ Cocoa中将RGB数据转换为位图
Can anyone show me a clear example of how to use
CGImageRef CGImageCreate ( size_t width, size_t height, size_t bitsPerComponent, size_t bitsPerPixel, size_t bytesPerRow, CGColorSpaceRef colorspace, CGBitmapInfo bitmapInfo, CGDataProviderRef provider, const CGFloat decode[], bool shouldInterpolate, CGColorRenderingIntent intent );I have a CGFloat dataBuffer [width * height * 3];
It contains all of the RGB data of the image. Essentially, it goes from pixel R (0,0), G (0,0), B(0,0), R(0,1)... to R(width, height), G(width,height), B(width,height)
I know the size of the image, width x height. How do I use the information that I have and create and CGImage??
Please help, thanks
I posted another question that encompasses the above question. It was answered correctly by nschmidt, here is the link
Converting RGB data into a bitmap in Objective-C++ Cocoa
最满意答案
数据提供者是最大的谜团。 答案是您需要创建一个CGDataProvider对象,该对象包含或可以提供您拥有的像素数据。
一些较小的奥秘是colorSpace和bitmapInfo传递的bitmapInfo 。 这些是CGColorSpace对象和CGBitmapInfo位掩码。
decode阵列的解释可能会更清晰,但很明显的是,您可能不需要一个decode阵列。 通过NULL 。
除了这些事情之外,所有事情都是不言而喻的,或者在这个函数的文档中有充分的解释。
I posted another question that encompasses the above question. It was answered correctly by nschmidt, here is the link
Converting RGB data into a bitmap in Objective-C++ Cocoa
更多推荐
发布评论