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;
}
Graphics::BeginContainer ( |
|
Graphics::BeginContainer ( |
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); }