Drawing RAW buffer to CGBitmapContext

Posted by Raj on Stack Overflow See other posts from Stack Overflow or by Raj
Published on 2010-04-08T05:32:07Z Indexed on 2010/04/08 19:33 UTC
Read the original article Hit count: 422

Filed under:

Hi all,

I have a raw image buffer in the RGB format. I need to draw it to CGContext so that I get a new buffer of the format ARGB. I accomplish this in the following way:

Create a data provider out of raw buffer using CGDataProviderCreateWithData and then create image out of the data provider with the api: CGImageCreate.

Now if I write this image back to the CGBitmapContext using CGContextImageDraw.

Instead of creating an intermediate image, is there any way of writing the buffer directly to CGContext so that I can avoid the image creation phase?

Thanks

© Stack Overflow or respective owner

Related posts about cocoa