Technical Q&A QA1045
Unexpected CG state changes
|
Q:
Why does my Core Graphics drawing state change unexpectedly?
A:
If you are using any of the convenience functions, such as
CGContextFillRectWithWidth, be aware that they make use of
the state variables and don't restore them. CGContextFillRectWithWidth,
for example, clears the current path and changes the line
width.
If you want to preserve the current settings, use CGContextSaveGState
and CGContextRestoreGState. Note that even these APIs don't
save the path. The only way to restore the path is to recreate
it.
[Jul 02 2001]
|