public GraphicsContainer BeginContainer() { if (stateStack == null) { stateStack = new object[MAX_GRAPHICS_STATE_STACK]; statePos = 0; } var gsCurrentState = new GraphicsContainer(++statePos); var currentState = new CGGraphicsState(); currentState.lastPen = LastPen; currentState.lastBrush = LastBrush; // Make sure we clone the Matrices or we will still modify // them after the save as they are the same objects. Woops!! currentState.model = modelMatrix.Clone(); currentState.view = viewMatrix.Clone(); currentState.compositingQuality = CompositingQuality; currentState.compositingMode = CompositingMode; currentState.interpolationMode = interpolationMode; currentState.pageScale = pageScale; currentState.pageUnit = graphicsUnit; //currentState.pixelOffsetMode = PixelOffsetMode; currentState.smoothingMode = smoothingMode; //currentState.textContrast = TextContrast; //currentState.textRenderingHint = TextRenderingHint; currentState.renderingOrigin = renderingOrigin; currentState.clipRegion = clipRegion; stateStack[gsCurrentState.NativeObject] = currentState; return gsCurrentState; }