cgImage()
Returns the texture’s image data as a Quartz 2D image.
Declaration
func cgImage() -> CGImageDiscussion
The cgImage() property returns the contents of a texture as a Quartz Image.
As an example use, you can create an image from a portion of your scene and save it to disk by doing the following:
Use the texture(from:) method to render the scene’s contents to a texture.
Call cgImage() on the result.
Use CGImageDestination to write the
CGImageout to disk.