(iphone) maintaining CGContextRef or CGLayerRef is a bad idea?

Posted by Eugene on Stack Overflow See other posts from Stack Overflow or by Eugene
Published on 2011-01-13T08:50:18Z Indexed on 2011/01/13 8:53 UTC
Read the original article Hit count: 170

Filed under:
|
|

Hi,

I need to work with many images, and I can't hold them as UIImage in memory because they are too big.
I also need to change colors of image and merge them on the fly.
Creating UIImage from underlying NSData, change color, and combine them when you can't have many images on memory is fairly slow. (as far as I can get)

I thought maybe I can store underlying CGLayerRef(for image that will be combined) and CGContextRef(the resulting combined image).

I am new to drawing world, and not sure if CGLayerRef or CGContextRef is smaller in memory than UIImage.
I recently heard that w*h image takes up w*h*4 bytes in memory.
Does CGLayerRef or CGContextRef also take up that much memory?

Thank you

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiimage