CGImageCreate
CGImageCreate is a Core Graphics function in macOS and iOS that creates a CGImage object from a CGBitmapContext. A CGImage object is an immutable representation of image data. The function takes a pointer to a CGBitmapContext and returns a CGImageRef, which is a reference to the newly created image. This process essentially snapshots the current contents of the bitmap context, making them available as a standalone image object.
This function is particularly useful when you've been drawing into a CGBitmapContext and want to extract the