System.Drawing.Graphics.EndContainer C# (CSharp) Method

EndContainer() public method

public EndContainer ( GraphicsContainer container ) : void
container GraphicsContainer
return void
        public void EndContainer(GraphicsContainer container)
        {
            if (stateStack == null)
            {
                stateStack = new object[MAX_GRAPHICS_STATE_STACK];
                statePos = 0;
            }

            if (container.NativeObject > statePos)
                return;

            if (container.NativeObject >= MAX_GRAPHICS_STATE_STACK)
                throw new OutOfMemoryException();

            var gstate = (CGGraphicsState)stateStack[container.NativeObject];
            LastPen = gstate.lastPen;
            LastBrush = gstate.lastBrush;
            modelMatrix = gstate.model;
            viewMatrix = gstate.view;

            CompositingMode = gstate.compositingMode;
            CompositingQuality = gstate.compositingQuality;
            interpolationMode = gstate.interpolationMode;
            pageScale = gstate.pageScale;
            graphicsUnit = gstate.pageUnit;
            //PixelOffsetMode = gstate.pixelOffsetMode;
            SmoothingMode = gstate.smoothingMode;
            //TextContrast = gstate.textContrast;
            //TextRenderingHint = gstate.textRenderingHint;
            renderingOrigin = gstate.renderingOrigin;
            clipRegion = gstate.clipRegion;

            // re-apply our ModelView to the graphics context
            applyModelView();

            statePos = container.NativeObject - 1;
        }

Usage Example

Example #1
1
		public void Draw(Graphics g)
		{
			g.FillRectangle(SystemBrushes.AppWorkspace, Bounds);

			g.DrawRectangle(Pens.Black, mCanvasMarginWidth - 1, mCanvasMarginHeight - 1, 800 + 1, 600 + 1);

			g.TranslateTransform(mCanvasMarginWidth, mCanvasMarginHeight);
			GraphicsContainer containerState = g.BeginContainer();
			g.SmoothingMode = SmoothingMode.HighQuality;

			DrawCanvas(g);

			g.SmoothingMode = SmoothingMode.Default;
			g.EndContainer(containerState);
			g.TranslateTransform(-mCanvasMarginWidth, -mCanvasMarginHeight);


			//mCanvasBufferGraphics.FillRectangle(SystemBrushes.AppWorkspace, Bounds);

			//mCanvasBufferGraphics.DrawRectangle(Pens.Black, mCanvasMarginWidth - 1, mCanvasMarginHeight - 1, 800 + 1, 600 + 1);

			//DrawCanvas(mCanvasBufferGraphics);


			//Rectangle src = Bounds;
			//Rectangle dest = new Rectangle(0, 0, (int)(Bounds.Width * mScale), (int)(Bounds.Height * mScale));
			//dest.X = (Bounds.Width / 2) - (dest.Width / 2);
			//dest.Y = (Bounds.Height / 2) - (dest.Height / 2);

			//g.DrawImage(mCanvasBufferImage, dest, src, GraphicsUnit.Pixel);
		}
All Usage Examples Of System.Drawing.Graphics::EndContainer