Added `preserveGraphics` and `graphicsLayer` parameters.