A CGImageRef does not have any mutating operations
There are no public functions to modify CGImage , however this does not mean that CGImageRef is immutable. CGImageRef opaque, that is, the internal structure is not documented, but there are ways to change it.
CGImageRef imageRef = ... struct CGImage image = *imageRef;
I assume that Core Graphics often creates internal copies of an image, for example CGImageCreateCopyWithColorSpace , perhaps uses CGImageCreateCopy internally. Copies can also be made when the image is drawn.
And, of course, this is a very good design for โsubclassingโ (not subclasses, since we have structures, not objects).
source share