I have been looking into private CoreGraphics API and found CGContextResetTopGState and CGContextReplaceTopGState. I was wondering if anyone knows What is TopGState?
I have been looking into private CoreGraphics API and found CGContextResetTopGState and CGContextReplaceTopGState. I
Share
If you look at the public API, you’ll find functions to save and restore the graphics state (gstate). Their documentation explains that gsave pushes the gstate onto a stack, and grestore pops the current gstate from that stack, restoring the previous gstate as the new current gstate.
With that knowledge, the meaning of “TopGState” is pretty obvious, and it’s also fairly clear what “ReplaceTopGState” probably does—Restore could be implemented by passing Replace the former previous/new current gstate.
I can guess that Reset also uses Replace, passing it the default/initial gstate.