This routine creates an offscreen bitmap graphics context pointing at a data buffer allocated with malloc() that is large enough to hold a rendered version of the image passed in to it.
After the image is drawn into this context, a data provider is created for the data buffer. A CGImageRef is created with this data provider and returned. The buffer used to hold the image data is allocated aligned on a 16-byte boundary, to give the OS the option to use Altivec. - Parameters:
-
| theImage | An image to render into an offscreen buffer. |
- Returns:
- New CGImageRef owned by the called.
- Todo:
- Instead of using the image's bit depth, use the bit depth of the main device. This should help speed up drawing by not requiring up or downsampling to blit to the device buffer.
Flip the context before rendering the image. Then control classes could use CGContextDrawImage instead of HIViewDrawCGImage and hopefully that would speed things up a little.
|